Why is Android Exoplayer hls live streaming not working? link type m3u8
Please give a solution
https://something.com/test/something.m3u8
我用过图书馆
implementation 'com.google.android.exoplayer:exoplayer-core:2.18.1'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.18.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.18.1'
//pass the video link and play
MediaItem media = MediaItem.fromUri(videoUrl);
exoPlayer.setMediaItem(media);
exoPlayer.prepare();
exoPlayer.play();
如果您使用hls,我建议使用hls库而不是dash:
implementation.com.google.android.extroplayer:extroplayer hls:2.18.1'
您可以在这里找到更多信息:https://exoplayer.dev/hls.html
尝试以下代码
val mediaItem = MediaItem.Builder()
.setUri(videoURI)
.setMimeType(MimeTypes.APPLICATION_M3U8)
.build()
exoPlayer.setMediaItem(mediaItem)
exoPlayer.prepare()
exoPlayer.play()