I have a remote playback device that is not a cast-device (let's call him Johnny 5 for now).
From a client app, I want to be able to cast content to a Chromecast or to my Johnny 5 device. The app is based on the Cast SDK v3.
In order to integrate my non-cast device, I built a Media Router Provider and extended the Session & SessionProvider classes. The Session Provider is added in the getAdditionalSessionProviders method of my OptionsProvider class.
I managed to make things work: my device appears in the list of the detected devices with the Chromecast (thanks to the MediaRouterProvider), and when I select it, session is started, and then I can cast contents on it.
However, it seems like the RemoteMediaClient object is Google-cast specific (cannot be used with non-cast devices), like a lot of Cast SDK features (mini controller, expanded controller...).
Question here regards the Cast Dialog, the Remote Control Notification and the Lock Screen: is that possible to use these with my non-cast device ? Or do I have to code the whole bunch to 'mimic' the Cast SDK features ?
Regarding the Cast Dialog, I would like to be able to customize it to have the same behavior as for the Chromecast without coding my own device picker or overriding the default button behavior.
The majority of work would be on your side, coding most everything for non-cast devices. Cast APIs, as you've noticed, do not interact with Sessions that are not CastSessions. So your options is to write an interface that is already implemented by Cast SDK for cast devices and by you for non-cast devices and try to use that common interface as much as possible. Getting things like lock screen amounts to creating a MediaStyle notification; CastSdk handles that for when there is a CastSession involved and you need to create a similar notification when a different type of Session is involved. This is true for almost all UI elements that the Cast SDK provides out of the box.
Related
I'm developing both an iOS and Android sender app, and after migrating from Cast SDK v2 to the Cast Application Framework (CAF) I'm no longer able to handle myself the connection to an already running receiver app.
My desired UX here is to prevent auto reconnections when user kills the app and runs it again, the user must explicitly connect again. It seems to me that the Automatic Reconnection feature is kicking on no matter what. On iOS nothing seems to be available, but on Android even setting the proper values seems to have no effect at all.
Are we now forced to use this UX or there is a solution for this? I didn't find anything on the UX guidelines forcing this behaviour.
Thanks
There's a documentation about how to Migrate CCL Sender App to the Cast Application Framework (CAF).
All of the functionality of CCL has been implemented in CAF, so once you migrate, you will no longer need to use CCL.
If you're building a CAF sender app or migrating to CAF, you should be
using CastContext and not GoogleAPIClient for accessing the Cast API.
It is proper to use GoogleAPIClient for accessing other Google Play
services APIs.
For more info about the Reconnection Logic using CAF, read the documentation here.
I am now refactoring my sender application for Android using the new v3 Google Cast API.
The problem I encounter is when i add
List<String> namespaces = new ArrayList<>();
namespaces.add("urn:x-cast:lalalalla");
...
return new CastOptions.Builder()
.setSupportedNamespaces(namespaces)
the Android app does not display the chromecast icon anymore (I guess it does not discover chromecast devices anymore).
What am I doing wrong with the namespace as without .setSupportedNamespaces it works fine as in the sample app?
Thanks!
This method can be a tad misleading sometimes. setSupportedNamespaces(ns) actually modifies the filter criteria for Cast devices for your app.
ie. it will only display Cast Devices currently running a receiver supporting the namespaces you specify. Unless this is what you want I'll advise to remove this call, you can still use custom namespaces when you're connected to your cast Device (after starting or joining a Cast Session)
I wrote a DMR for android with the open source project CyberLink4Java. Test it with tools that DLNA group released (Golden DMC & Gloden DMS). I create a Device with proper description file. Now it can push play.
But it don't support control by the DMC.
On the DMC UI, the control buttons(play, pause and stop) are grey.
There must be some data exchange to tell the DMC that it support these controls during the DMR service start. But I can't find in the spec. Any idea on what's wrong?
The way to expose transport-controlling actions that are valid at a given time is the CurrentTransportActions state variable and the corresponding method GetCurrentTransportActions. These features are optional but conditionally required so if you implement one you need to implement both. CurrentTransportActions is like most variables in AVTransport: it's not evented on its own but value changes will be included in LastChange events. This is all documented in AVTransport service definition.
That said, mostly a DMC can figure out the valid actions based on DMR state even if the above features aren't supported: e.g. if AVTransportURI is empty, showing playback controls doesn't make sense.
was trying out the CastHelloText-android-master sample in the Google cast sdk.
it seems that I can't get device discovery to work if I change the MediaRouteSelector to look for CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID. The Cast button didn't appear. but if I change it to CastMediaControlIntent.CATEGORY_CAST, I'm able to get the button to show up.
The reason why I doing this is that I intend to use the default media receiver instead of deploying my own receiver.
I was wondering if there's a bug here. or I should just stick to CATEGORY_CAST for discovery. If you have a way to make it work, pls show me the way, Thanks.
Those two static variables have different purposes. According to the doc http://developer.android.com/reference/com/google/android/gms/cast/CastMediaControlIntent.html:
CATEGORY_CAST - A control category for discovering Cast devices.
DEFAULT_MEDIA_RECEIVER_APPLICATION_ID - The application id for the Cast Default Media Receiver.
So, use CATEGORY_CAST for discovery and use the DEFAULT_MEDIA_RECEIVER_APPLICATION_ID in your launchApplication call.
I'm developing an Android app which supports Chromecast and to do that I'm using a combination of MinimalCastMediaRouteProvider + a custom receiver. All is well with the playback but the Chomecast UX guide has a section headed Cast menu functions appropriately for available receiver devices. It seems to state that when the Chromecast device is already connected to a service it should have a label indicating it, like the following with netflix:
The issue is that on my device all I see is this:
where it's missing the "casting xxx" while I have another device casting to it. Is there something I need to set in my receiver app or is it something in the Android code? I don't see any documentation about it.
You don't need to do anything on your side at this point; there is currently a bug in the preview sdk that doesn't let that to work properly.