【问题标题】:Why Android Exoplayer hls live streaming not working? link type m3u8为什么 Android Exoplayer hls 直播不工作?链接类型 m3u8
【发布时间】:2022-11-23 21:02:39
【问题描述】:
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();

【问题讨论】:

    标签: video-streaming http-live-streaming exoplayer live m3u8


    【解决方案1】:

    如果您使用的是 hls,我会推荐破折号上的 hls 库:

    实施 'com.google.android.exoplayer:exoplayer-hls:2.18.1'

    你可以在这里找到更多:https://exoplayer.dev/hls.html

    【讨论】:

      【解决方案2】:

      试试下面的代码

      val mediaItem = MediaItem.Builder()
                  .setUri(videoURI)
                  .setMimeType(MimeTypes.APPLICATION_M3U8)
                  .build()
      exoPlayer.setMediaItem(mediaItem)
      exoPlayer.prepare()
      exoPlayer.play()
      

      【讨论】:

        猜你喜欢
        • 2014-02-12
        • 1970-01-01
        • 1970-01-01
        • 2015-10-03
        • 2021-10-27
        • 2016-12-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多