Is there a non-youtube example to implement DASH using ExoPlayer?

喜欢而已 提交于 2019-11-30 16:21:53

问题


Hi I am looking for an example to configure ExoPlayer for DASH. But the example I found uses Youtube videos. Is there an example on videos which are not on youtube? Can DASH be configured for any video on the internet?


回答1:


Yes, ExoPlayer can play any DASH, SmoothStreaming, HLS or MP4 Progressive download over HTTP URLs. The demo application provided in ExoPlayer source code can be modified to add any video that will be shown in the startup Activity. To do that, edit https://github.com/google/ExoPlayer/blob/master/demo/src/main/java/com/google/android/exoplayer/demo/Samples.java file to add a new sample set. Example:

public static final Sample[] CUSTOM_DASH_VIDEOS = new Sample[] {
   new Sample("Some User friendly name of video 1",
    "http://www.somewhere.com/somecontent.mpd?param1=val1&param2=val2", DemoUtil.TYPE_DASH),
   new Sample("Some User friendly name of video 2",
   "http://www.somewhere.com/somecontent.mpd?param1=val1&param2=val2", DemoUtil.TYPE_DASH),
};

Now, in https://github.com/google/ExoPlayer/blob/master/demo/src/main/java/com/google/android/exoplayer/demo/SampleChooserActivity.java add a new row in sample adapter.

sampleAdapter.add(new Header("Custom DASH Videos"));
sampleAdapter.addAll((Object[]) Samples.CUSTOM_DASH_VIDEOS);

Hope this answers your question.



来源:https://stackoverflow.com/questions/28739060/is-there-a-non-youtube-example-to-implement-dash-using-exoplayer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!