ExoPlayer:无法播放以 .aac 结尾的流媒体 URL
这是流媒体网址:
"https://rfcmedia.streamguys1.com/70hits.aac"
这是我的代码:
val dataSourceFactory: DataSource.Factory = DefaultHttpDataSource.Factory()
val hlsMediaSource: HlsMediaSource = HlsMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri("https://rfcmedia.streamguys1.com/70hits.aac"))
exoPlayer.setMediaSource(hlsMediaSource)
exoPlayer.prepare()
错误:
原因: com.google.android.exoplayer2.ParserException:输入不以 #EXTM3U 标头开头。
我缺少什么。
Here is the streaming url:
"https://rfcmedia.streamguys1.com/70hits.aac"
Here is my code:
val dataSourceFactory: DataSource.Factory = DefaultHttpDataSource.Factory()
val hlsMediaSource: HlsMediaSource = HlsMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri("https://rfcmedia.streamguys1.com/70hits.aac"))
exoPlayer.setMediaSource(hlsMediaSource)
exoPlayer.prepare()
The error:
Caused by: com.google.android.exoplayer2.ParserException: Input does not start with the #EXTM3U header.
What am I missing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于某种原因,ExoPlayer 似乎不会自动检测到这是一个音频 Uri - 不确定为什么,但下面的代码对我有用:
It appears that ExoPlayer is not automatically detecting that this is an audio Uri for some reason - not sure why, but the below code worked for me: