android - 在流中区分 HLS 内容

标签 android exoplayer

我想使用 Google 的 ExoPlayer 区分从 HLS 流传入的数据的内容类型。

具体来说,我想区分视频和纯音频内容。

谢谢!

最佳答案

根据 Exoplayer 文档,播放器目前根本不支持检测媒体格式:

ExoPlayer does not (yet) automatically detect the format of the media being played. An application needs to know the format of the media it wishes to play in order to construct an ExoPlayer capable of playing it. Removing this limitation is tracked by Issue #438.

上面提到的问题链接是:https://github.com/google/ExoPlayer/issues/438

如果您可以访问原始流(它未加密),您可以自己查看它并从那里弄清楚它是音频还是视频,但这需要合理的工作量:HLS 是一种“流媒体协议(protocol)”流式传输 MPEG-2 传输流,分块成段。这些 MPEG-2 传输流中的每一个都可以包含音频和视频。

MPEG 标准(MPEG 1 和 MPEG 2)使用流 ID 来识别传输流中的每个单独的音频或视频流。音频流编号为 110X XXXX,视频流编号为 1110XXXX - 因此您可以检查 MPEG2 传输流中的所有单个流,看看它是纯音频、纯视频还是混合。

关于android - 在流中区分 HLS 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30792079/

相关文章:

java - 无法在 android studio 谷歌地图中获取标记和位置

android - 使用可本地化的格式字符串进行数据绑定(bind)

android - 使用 Android Exoplayer 调整 Dash 流音量

android - 防止在 ExoPlayer 中更改最大比特率时重新缓冲

java - 绘制行车路线指示 apk 未在物理设备上运行

java - Android Clean 架构中的登录流程

android - 使用单个 TableLayout 而不是多个 LinearLayouts 的优势,因为 TableRow 仅扩展 LinearLayout

Android Kotlin - 从今天开始如何使用 ExoPlayer SimpleCache

android - 在 ExoPlayer 中检测暂停/恢复

android - 如何在 Exoplayer Android 库中为 HLS 流设置 CloudFront Cookies?