user2628517
user2628517

Reputation: 31

How does one query the "parameters" sent to a Chromecast Reciever app?

The docs shown on this page demonstrate how to send arbitrary parameters from a sender app to a receiver app:

https://developers.google.com/cast/chrome_sender

Specifically, here:

request.parameters = "v=abcdefg";

But, I don't see how the receiver app is supposed to access those parameters once sent? Does someone have an example of jscript for a receiver to see this string?

Upvotes: 2

Views: 1501

Answers (2)

Jonathan Sadowski
Jonathan Sadowski

Reputation: 31

It looks like Chromecast pulls down the built-in application settings from the following URL: https://clients3.google.com/cast/chromecast/device/config

If you take a look at that file, you'll notice that many of the URLs look like this:

https://www.youtube.com/tv?${POST_DATA}

Notice that ${POST_DATA} is specified as part of the URL that defines the application. I am only guessing, but I would assume that unless your application is setup similarly on Google's whitelist, that you'll be unable to receive that data via the URL.

It may be worth using a channel to send the data you require to your application instead of trying to use request.parameters.

Upvotes: 3

jterrace
jterrace

Reputation: 67083

This should be passed in the query parameter section of the URL that the receiver loads. For example, if your app URL is:

http://example.com/foo.html

and you set:

request.parameters = "bar=baz";

then the full URL should come out as:

http://example.com/foo.html?bar=baz

From your receiver JavaScript, you can interrogate this value with document.location.search.

Upvotes: 1

Related Questions