如何在Adapter / RecyclerView中使用Exoplayer

这是我编写的代码,但是当我单击按钮来初始化ExpoPlayer时,它不起作用。

  private  fun initializeExoplayer(){
      simpleExoPlayer = ExoPlayerFactory.newSimpleInstance(
          DefaultRenderersFactory(context),DefaultTrackSelector(adaptiveTrackSelectionFactory)
      )
      simpleExoPlayer.prepare(buildMediaSource())
      itemView.simpleExoPlayerView.player = simpleExoPlayer
      simpleExoPlayer.seekTo(playbackPosition)
      simpleExoPlayer.playWhenReady = true
      simpleExoPlayer.addListener(this)
    }

    private fun buildMediaSource(): MediaSource {
      var uri: Uri = Uri.parse("https://player.vimeo.com/external/357507131.m3u8?s=17a1326569611e13080cbe99344549fcc6b5613d")
      val dataSourceFactory: DataSource.Factory = DefaultHttpDataSourceFactory(Util.getUserAgent(context,"App Name"))
      return  HlsMediaSource.Factory(dataSourceFactory).createMediaSource(uri)

    }

我已经尝试了上面的代码,但是没有任何人可以帮助我解决这个问题?

sgflh 回答:如何在Adapter / RecyclerView中使用Exoplayer

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3003260.html

大家都在问