问题
On the receiver examples I always see cast.receiver.RemoteMedia.NAMESPACE
used. Is that supposed to be replaced by my own name? I tried using 'ramp'
I also tried 'myownnamespace'
and 'ramp','myown'
and all of those with brackets around them. Any time I change it from cast.receiver.RemoteMedia.NAMESPACE
my code stops working. Below is the code I am talking about:
var receiver = new cast.receiver.Receiver(
'YOUR_APP_ID_HERE',
[cast.receiver.RemoteMedia.NAMESPACE],
"",
5);
var remoteMedia = new cast.receiver.RemoteMedia();
remoteMedia.addChannelFactory(
receiver.createChannelFactory(cast.receiver.RemoteMedia.NAMESPACE));
I also tried something I found on the document, didn't work either.
var receiver = new cast.receiver.Receiver('myappid', ['ramp', 'other']);
var rampHandler = new cast.receiver.RemoteMedia();
rampHandler.addChannelFactory(receiver.createChannelFactory('ramp'));
var channelHandler = new cast.receiver.ChannelHandler('other');
channelHandler.addChannelFactory(receiver.createChannelFactory('other'));
So what values should I be putting there? should my android app reference those values somewhere?
Thanks.
回答1:
The "cast.receiver.RemoteMedia.NAMESPACE" is for media playback using the HTML5 video tag. That channel will use the RAMP protocol for media controls. The Cast SDK provides utility classes to manage a media channel (see MediaProtocolMessageStream, MediaProtocolCommand).
If you don't want to play media then you can create your own channel with its own namespace. Look at the Tic-Tac-Toe sample app. Your channel prototype should declare your namespace in JavaScript and then that is used to initialize the receiver and add your custom channel handler.
If your app plays media then you should just have to change the 'YOUR_APP_ID_HERE' in the receiver and use the same app id in your Android code to start a session.
来源:https://stackoverflow.com/questions/18499057/what-do-i-put-as-cast-receiver-remotemedia-namespace