Exoplayer not working for one particular m3u8 file

  Kiến thức lập trình

so basically my implementation is working fine for the below test m3u8 urls

  • a -> https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8
  • b -> https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8

here is the implementation

private fun initExo(url: String) {
    layoutVideoWidgetBinding!!.exoVideoPlayer.visible()
    layoutVideoWidgetBinding!!.loaderLa.gone()
    exoPlayer = ExoPlayer.Builder(layoutVideoWidgetBinding!!.root.context).build()
    exoPlayer?.playWhenReady = true
    layoutVideoWidgetBinding!!.exoVideoPlayer.player = exoPlayer

    val defaultHttpDataSourceFactory = DefaultHttpDataSource.Factory()
    val mediaItem = MediaItem.fromUri(url)
    val mediaSource =
        HlsMediaSource.Factory(defaultHttpDataSourceFactory).createMediaSource(mediaItem)


    exoPlayer?.apply {
        setMediaSource(mediaSource)
        seekTo(playbackPosition)
        playWhenReady = playWhenReady
        prepare()
        addListener(playbackStateListener)
    }
}

but its not working for my own URL whose content is below, but it is working fine when i use it via VLC and on web:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:138
#EXT-X-TARGETDURATION:2
#EXT-X-PLAYLIST-TYPE: EVENT
#EXTINF:1.796,
869409066980304_front-138.ts
#EXTINF:1.775,
869409066980304_front-139.ts
#EXTINF:1.772,
869409066980304_front-140.ts
#EXTINF:1.797,
869409066980304_front-141.ts
#EXTINF:1.783,
869409066980304_front-142.ts
#EXTINF:1.775,
869409066980304_front-143.ts
#EXTINF:1.161,
869409066980304_front-144.ts
#EXT-X-DISCONTINUITY
#EXTINF:1.894,
869409066980304_front-145.ts
#EXTINF:1.938,
869409066980304_front-146.ts
#EXTINF:1.668,
869409066980304_front-147.ts
#EXT-X-DISCONTINUITY
#EXTINF:1.241,
869409066980304_front-148.ts
#EXTINF:1.217,
869409066980304_front-149.ts
#EXTINF:1.153,
869409066980304_front-150.ts
#EXTINF:0.964,
869409066980304_front-151.ts
#EXT-X-DISCONTINUITY
#EXTINF:1.002,
869409066980304_front-152.ts
#EXT-X-DISCONTINUITY
#EXTINF:1.895,
869409066980304_front-153.ts
#EXTINF:1.133,
869409066980304_front-154.ts
#EXT-X-DISCONTINUITY
#EXTINF:0.000,
869409066980304_front-155.ts
#EXT-X-DISCONTINUITY
#EXTINF:1.839,
869409066980304_front-156.ts
#EXTINF:0.275,
869409066980304_front-157.ts

exoplayer is throwing “ERROR_CODE_IO_UNSPECIFIED”

and is giving this error -> androidx.media3.exoplayer.ExoPlaybackException: Source error

LEAVE A COMMENT