我试图将android cast v3集成到我的应用中,但无法使其正常运行。
我完全按照这个谷歌文档写的: https://developers.google.com/cast/docs/android_sender_integrate (直到标题:"配置设备发现")
当我点击MediaRouteButton时打开的对话框在" youtube"时无法找到任何设备。应用程序成功找到我的android-tv设备。
我错过了什么?
// the code of the CastOptionsProvider:
class CastOptionsProvider implements OptionsProvider {
@Override
public CastOptions getCastOptions(Context appContext) {
return new CastOptions.Builder().setReceiverApplicationId(
CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID).build();
}
@Override
public List<SessionProvider> getAdditionalSessionProviders(Context context) {
return null;
}
}
// the code in the custom view:
mMediaRouteButton = (MediaRouteButton)findViewById(R.id.media_route_button);
CastButtonFactory.setUpMediaRouteButton(getContext(), mMediaRouteButton);
mCastContext = CastContext.getSharedInstance(getContext());
并在清单中(在应用程序标记内):
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="com.bla-company-bla.core.cast.CastOptionsProvider"/>