How can I play a .ts in Exoplayer 2

5k views Asked by At

I started using ExoPlayer recently to play stream links on my android application, such as .m3u8 and .mp4 files, but when I tried to play .ts files, the message below started appearing in the 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)

Is there a possibility to play .ts streams with EXOPlayer2?

2

There are 2 answers

0
Idee On BEST ANSWER

It is not a supported format. Check here https://google.github.io/ExoPlayer/supported-formats.html

0
korchix On

MPEG-TS ist supported. hier in there FAQ https://google.github.io/ExoPlayer/faqs.html are telling that you have to use the Flags FLAG_ALLOW_NON_IDR_KEYFRAMES and FLAG_DETECT_ACCESS_UNITS to make it works. but right now i don't know how .