我如何在 Exoplayer 2 中播放 .ts
How can I play a .ts in Exoplayer 2
我最近开始使用 ExoPlayer
在我的 android 应用程序上播放流链接,例如 .m3u8
和 .mp4
文件,但是当我尝试播放 .ts
文件,下面的消息开始出现在 Android logcat:
Source error.
com.google.android.exoplayer2.source.UnrecognizedInputFormatException:
Input does not start with the #EXTM3U header.
at
com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:119)
at
com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:43)
at
com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:115)
at
com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:315)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
是否可以使用 EXOPlayer2
播放 .ts
流?
该格式不受支持。在这里查看 https://google.github.io/ExoPlayer/supported-formats.html
支持 MPEG-TS。
那里有常见问题 https://google.github.io/ExoPlayer/faqs.html
告诉你必须使用标志 FLAG_ALLOW_NON_IDR_KEYFRAMES 和 FLAG_DETECT_ACCESS_UNITS 才能使其工作。但现在我不知道怎么办。
我最近开始使用 ExoPlayer
在我的 android 应用程序上播放流链接,例如 .m3u8
和 .mp4
文件,但是当我尝试播放 .ts
文件,下面的消息开始出现在 Android logcat:
Source error. com.google.android.exoplayer2.source.UnrecognizedInputFormatException: Input does not start with the #EXTM3U header. at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:119) at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:43) at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:115) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:315) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)
是否可以使用 EXOPlayer2
播放 .ts
流?
该格式不受支持。在这里查看 https://google.github.io/ExoPlayer/supported-formats.html
支持 MPEG-TS。 那里有常见问题 https://google.github.io/ExoPlayer/faqs.html 告诉你必须使用标志 FLAG_ALLOW_NON_IDR_KEYFRAMES 和 FLAG_DETECT_ACCESS_UNITS 才能使其工作。但现在我不知道怎么办。