在videoview中加快视频加载速度 [英] Making video load faster in videoview
问题描述
我通过URL在视频视图中播放视频...一切正常,甚至可以播放视频
I play a video in a videoview from an URL...everything works fine and even the video plays
但是唯一的问题是视频开始播放需要花费将近10秒钟的时间,这可能会让用户感到烦恼
But the only problem is that the video takes almost 10 seconds to start playing which might be kind of annoying to the user
我尝试了不同的URL,并且它们相同,视频长360p,长6秒
I have tried different URLs and its the same, the videos are 360p and 6sec long
是默认的慢速媒体播放器吗?
Is it the default media player that is slow?
我的堆栈溢出,但是找不到合适的答案,曾经搜索过各种第三方视频库,但是找不到一个
I have the stack overflow but could not find a suitable answer and ever searched for various 3 rd party videos libraries but could not find one
即使尝试过Google的exoplayer库,但在我看来文档也不尽人意
Even tried google's exoplayer library but the documentation is not that good in my view
有什么解决办法可以解决这个问题吗?
Is there any solution how to overcome this problem?
我的代码
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String videeourl = "http://techslides.com/demos/sample-videos/small.3gp";
VideoView videoView = (FastVideoView)findViewById(R.id.video);
videoView.setMediaController(new MediaController(this));
videoView.setVideoPath(videeourl);
videoView.start();
}
}
推荐答案
考虑使用Exoplayer.您可以在这里找到开源项目: https://github.com/google/ExoPlayer
Consider using Exoplayer. You can find the open source project here: https://github.com/google/ExoPlayer
它使用基于HTTP的动态自适应流(DASH),将较长的内容分成HTTP段.
It uses Dynamic Adaptive Streaming over HTTP (DASH),breaks long content into HTTP segments.
这篇关于在videoview中加快视频加载速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!