问题
I am building a Chromecast Android sender app that needs to have two receiver apps, one of type Default / Styled Receiver App and the other as Remote Display.
I am setting the CastOptionsProvider
for my app in my AndroidManifest.xml
as :
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="com.myapp.CastOptionsProvider" />
CastOptionsProvider.xml
class CastOptionsProvider : OptionsProvider {
override fun getCastOptions(context: Context): CastOptions {
// ... Other details
return CastOptions.Builder()
.setReceiverApplicationId(context.getString(R.string.remote_app_id))
.setCastMediaOptions(mediaOptions)
.build()
}
//...other implementations
}
Since this class is not instantiated by me but by the SDK itself, how can I put receiver IDs for both the receiver apps here ?
R.string.remote_app_id
is the place where I need to put receiver ids for both the apps.
Even if I create two options provider classes, one for each type, is it possible to put both the classes as meta-data
in AndroidManifest.xml
回答1:
I posted the same question on Github at Castvideo-android and got the following reply from Leon Nicholls
Only one receiver ID is supported by the Cast SDK. Also, we highly recommend that you don't use the Remote Display API anymore since it is deprecated.
So in conclusion, it's not supported as of now.
来源:https://stackoverflow.com/questions/54052135/styled-receiver-and-remote-display-from-the-same-sender-app-chromecast-android