如何从ExoPlayer Cast扩展创建CastPlayer?

时间:2018-04-04 09:33:12

标签: android exoplayer exoplayer2.x

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

1 个答案:

答案 0 :(得分:0)

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实例交换。

A blog post on Medium说明应用程序需要提供哪些演员表。