How to find out which App is running on the Chromecast receiver? - chromecast

In my Android Sender Application, I would like to display the status of a newly discovered Chromecast device. For e.g if another app lets say Youtube is currently casting to this device, then I would like to put a status as "casting Youtube" next to the device name in my receiver list.
For this, once I discover a media route, I connect to that device. On getting a ConnectionCallbacks.onConnected() event, I try to retrieve the application metadata using Cast.CastApi.getApplicationMetadata(GoogleApiClient). But I'm getting a null value here. When I run my Sender App, I make sure that I'm casting to the same Chromecast receiver from another app like Youtube. So I expect the application metadata to reflect Youtube app details its like appId, name etc. Is there a different way to achieve this?

YouTube is still using the old preview SDK so that might be a factor in seeing null. Please try an app that is using the new SDK and see if that returns more useful data. I know there was a bug which caused that method to return null all the time but I believe that was fixed with the recent play services update.

Related

Building a cast action for google home

I want to know please if it is possible to build a cast app for google home which casts content from an app to Chromecast using Google home. For example, "Ok google, play XXXAudio/videoContent from XXXApp on the TV."
This means that I want to cast a content from XXXApp to Chromecast, but without using the phone to do that, but rather using Google home.
I have imagined doing that like : Google home retrieves the requested data from the XXXApp then casts the content, through the receiver, to Chromecast. The requested content is then displayed on the TV.
Any help or advice will be appreciated.
It depends exactly what you want your cast app to do.
If you want to be able to provide media just like someone like Spotify or a local streaming radio station does, you need to parter with Google. You'll then have access to a range of partner solution feed options.
If you have other cast apps that you want, or other things that you may want to cast to a tv (for example) - these aren't currently available. However, Smart Displays using the Assistant are coming shortly, and these may start to introduce capabilities that will also be available for cast devices.
One could probably do something that started the cast app from an existing supported device and then, once running, control it via an Action. But this isn't something directly available right now.

Chromecast receiver, how to load media without explicit cast sender request?

Media exists on an external server that I would like to play on my cast receiver (a modified version of Google's CastReferencePlayer). The receiver is in constant communication with this server (via long-polling), and is instructed by the server when it needs to play a certain media file.
The issue I'm having is that I need the receiver to be able to essentially "tell itself" to play this media. This breaks with the standard sender-receiver communication protocol, but is necessary for my application and I don't believe too outlandish of a request.
As I understand it, the MediaManager object automagically receives all requests from cast senders to play media. I am looking for a way to hook into the MediaManager and tell it to play certain media without receiving a formal request from a sender.
Despite a lot of searching and reading through documentation, I can't find a way to do this. Does anyone know of any way to accomplish this?
i saw this on the google plus chromecast dev page, though i havent gotten it to work yet
Add/remove items using: https://developers.google.com/cast/docs/reference/receiver/cast.receiver.MediaManager#insertQueueItems, https://developers.google.com/cast/docs/reference/receiver/cast.receiver.MediaManager#removeQueueItems

Chromecast icon not shown with local ip

I'm createing a chromecast app for android. I registered my application on Google Cast SDK Developer Console and used the id from there.
As a test I first entered https://google.com as url for my application. that worked perfectly fine. i then changed this url to a local one http://192.168.0.18:8100. Problem is, it allways opens google on chromecast. so i created a new application, but since i did that, the cast button is not shown anymore.
Is my local url valid for chromecast and maybe does it take some time to accept my changed in cast sdk console?
thanks

Unable to debug the Custom Receiver Application of Chromecast

I've downloaded Chrome cast sender and receiver application from GitHub. While running the application I am getting some error on my device as well as sender application. I want to debug the Receiver Application. I've followed all the guidelines mentioned on this link [https://developers.google.com/cast/docs/custom_receiver#debugging ] but unable to even open the debug window using the mentioned URL.
Please suggest me something that I need to check to get it debugged as I am new to chrome cast.
Thanks in advance!
You need to have your own application id (by registering your app in Cast Developer Console). Follow the instructions for registration and in that same page, scroll down to Devices and follow those steps as well. After all of that, give it a bit of time, reboot your chromecast and it should work when your app is running on the chromecast.

How to do a Chromecast API White List URL page?

I want to integrate with the Chromecast Developer API so I want my chromecast(being shipped) whitelisted but you are supposed to supply 2 URLs. What exactly are these for? I might just be confused about how it works. Thanks.
EDIT:
I found this source to be a good example to demonstrate how to use it. The HTML in the receiver is what you would have the white listed URL pointing to.
A Receiver is a HTML5 application (HTML/JS/CSS3) that runs on the Chromecast device. Your Sender application must send an APP ID to the device, which then looks up the app in a table and loads your page for you. You then use the App ID in your Receiver (on the Chromecast device) to open a connection to your Sender.
We ask you to provide one or two URL's. We expect that you'll want to have a development URL, and eventually a production one. You only need to provide one.
From the Chromecast Device Whitelist Request Form
Please provide at least one receiver URL, we will provide an
Application ID for each of them, 2 max (typically, you'll list a
production URL and a testing URL)

Resources