我正在努力为我的应用添加Chromecast支持。
我经历过:https://codelabs.developers.google.com/codelabs/cast-videos-android/#0
来自代码实验室的应用程序链接:https://github.com/googlecodelabs/cast-videos-android/archive/master.zip
我可以使用示例应用程序投射视频,但如果我将Receiver应用程序ID设置为DEFAULT_MEDIA_RECEIVER_APPLICATION_ID,则在同一个应用程序中,然后我在SessionManagerListener回调中收到错误15。
@Override
public void onSessionStartFailed(CastSession session, int error) {
//error =15
}
以下是代码实验室的CastOptionsProvider(读取代码注释):
public class CastOptionsProvider implements OptionsProvider {
@Override
public CastOptions getCastOptions(Context context) {
return new CastOptions.Builder()
.setReceiverApplicationId(context.getString(R.string.app_id)) // Here,I'm trying to use DEFAULT_MEDIA_RECEIVER_APPLICATION_ID = "CC1AD845"
.build();
}
@Override
public List<SessionProvider> getAdditionalSessionProviders(Context context) {
return null;
}
}
我知道错误15意味着会话超时。我无法使用DEFAULT_MEDIA_RECEIVER_APPLICATION_ID获得任何有用的示例。
提前致谢。
我也提到了线程,Android Sender App getting timeout when trying to connect to Chromecast
Android TV的Google Cast接收器版本是出厂版本。更新Google Cast Receiver后,它解决了问题。有关详细信息,请参阅以下链接
https://support.google.com/chromecast/answer/7438776?hl=en-IN