简体   繁体   English

如何在 Exoplayer 2 中播放 .ts

[英]How can I play a .ts in Exoplayer 2

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:我最近开始使用ExoPlayer在我的 android 应用程序上播放流链接,例如.m3u8.mp4文件,但是当我尝试播放.ts文件时,以下消息开始出现在 Android logcat 中:

Source error.源错误。 com.google.android.exoplayer2.source.UnrecognizedInputFormatException: Input does not start with the #EXTM3U header. com.google.android.exoplayer2.source.UnrecognizedInputFormatException:输入不以#EXTM3U 标头开头。 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)在 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)

Is there a possibility to play .ts streams with EXOPlayer2 ?有没有可能用EXOPlayer2播放.ts流?

It is not a supported format.它不是受支持的格式。 Check here https://google.github.io/ExoPlayer/supported-formats.html在这里查看https://google.github.io/ExoPlayer/supported-formats.html

MPEG-TS ist supported.支持 MPEG-TS。 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. hier 在那里的常见问题解答https://google.github.io/ExoPlayer/faqs.html告诉您必须使用标志 FLAG_ALLOW_NON_IDR_KEYFRAMES 和 FLAG_DETECT_ACCESS_UNITS 才能使其工作。 but right now i don't know how .但现在我不知道如何。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM