如何在Exoplayer 2

时间:2017-09-16 23:59:44

标签: android exoplayer exoplayer2.x

我最近开始使用ExoPlayer在我的Android应用程序中播放流链接,例如.m3u8.mp4文件,但是当我尝试播放.ts个文件时,下面的消息开始出现在Android监视器中:

  

来源错误。                                                                                com.google.android.exoplayer2.source.UnrecognizedInputFormatException:   输入不以#EXTM3U标头开头。                                                                                    在   com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:119)                                                                                    在   com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:43)                                                                                    在   com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:115)                                                                                    在   com.google.android.exoplayer2.upstream.Loader $ LoadTask.run(Loader.java:315)                                                                                    在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)                                                                                    在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:607)                                                                                    在java.lang.Thread.run(Thread.java:761)

是否可以使用.ts播放EXOPlayer2个流?

2 个答案:

答案 0 :(得分:2)

它不是受支持的格式。点击https://google.github.io/ExoPlayer/supported-formats.html

答案 1 :(得分:1)

支持MPEG-TS。 在那里的常见问题解答https://google.github.io/ExoPlayer/faqs.html 告诉您必须使用标志FLAG_ALLOW_NON_IDR_KEYFRAMES和FLAG_DETECT_ACCESS_UNITS使其起作用。但是现在我不知道如何。