【问题标题】:How to create a CastPlayer from ExoPlayer Cast extension?如何从 ExoPlayer Cast 扩展创建 CastPlayer?
【发布时间】:2018-04-04 09:33:12
【问题描述】:

我已经在我的应用程序中运行了ExoPlayer 2.7.2。我想向它添加 Cast 功能。如何使用 ExoPlayer Cast 扩展将我的原版 ExoPlayer 更改为 CastPlayer

【问题讨论】:

标签: android exoplayer exoplayer2.x


【解决方案1】:

Github 上有一个demo app for cast in the ExoPlayer repository,它创建了一个 CastPlayer,如下所示:

// set up the cast player
castPlayer = new CastPlayer(castContext);
castPlayer.addListener(this);
castPlayer.setSessionAvailabilityListener(this);
// set to a PlayerView for controls
castControlView.setPlayer(castPlayer);

鉴于您的代码是针对Player 接口编写的,您可以将本地播放器与CastPlayer 实例交换。

blog post on Medium 解释了应用需要提供哪些演员。

猜你喜欢
  • 2020-10-31
  • 1970-01-01
  • 1970-01-01
  • 2016-06-12
  • 1970-01-01
  • 2013-08-12
  • 1970-01-01
  • 1970-01-01
  • 2011-12-19
相关资源
最近更新 更多