Closed xat closed 9 years ago
That is a very good question, and I'm glad you asked it ! Well ... I don't know :)
Last time I checked the YouTube app still used the old DIAL protocol and when started through CASTV2 it didn't even show the supported protocols in the device status. If google has upgraded to CASTV2 you can probably get hints by snooping on traffic with the method described here.
That's all I can tell you, sadly.
Thanks for your input :) Okay, I'll try sniffing the traffic.
Let me know what you find
finally found out how to get it running :)
The youtube video must be loaded over an other namespace called urn:x-cast:com.google.youtube.mdx
. To load the video the request JSON must look like this:
{
type: 'flingVideo',
data: {
currentTime: 0,
videoId: 'FNyASCBhgok'
}
}
After the video was loaded you can switch back to the urn:x-cast:com.google.cast.media
channel and control the playback like 'normal'.
Also created a proof of concept youtube sender: https://gist.github.com/xat/9ccf5eab2d0adb34fe8d
That's awesome :)
What would be even more awesome would be to have a requireable standalone Application like DefaultMediaReceiver. Plus it could serve as an exemple to people wishing to implement their own sender.
yeah, basicly it could inherit from DefaultMediaReceiver and load the urn:x-cast:com.google.youtube.mdx
channel in the constructor. Besides that only the load method needs be overwritten (I think).
I think making it inherit from Application would make things more understandable for newcomers and and people wishing to controls apps that don't use the media protocol. The exemple would feel more complete IMO. I think I'll try to build it except if you want to do it. In any case I'll link it from castv2-client's README.
Hmm, isn't that exactly what I created in that gist already (besides that it needs some small refactorings)?
Not that different yeah, though I think it could be implemented in the spirit of the lib by cloning DefaultMediaReceiver and doing the necessary (small) changes.
okay, I'll give it a shot :)
Would you also suggest creating an separated YoutubeController? Like the MediaController, but with just a load method?
Sure. It looks a bit overkill given the usage, but it would fit the global pattern well and make things a bit more predictable for devs peering inside.
okay, I've created a repository for it and added you as contributor :) Or did you want to add the code directly into the castv2-client repo? https://github.com/xat/castv2-youtube
That's perfect as it is ... awesome work. I hope more apps will be done like that !
Just one minor thought : "receiver" usually is used for the part of the app running on the dongle. The clients are called "senders". I've used the DefaultMediaReceiver name to make it clear what app was being used. Here I can feel a bit more the limits of this naming practice. Though I don't have a good solution. Maybe YoutubeSender would be more appropriate. Or "Youtube" only. I'll think more about it ... The Chromecast concepts being quite a bit complicated it would be nice to have a clear naming structure. Let me know if you have an idea or opinion about how this.
It could also be seen as a direct interface to the receiver ... Not so sure about this :)
Great as it is anyway.
too late, renamed to "Youtube". Your totally right.. "receiver" is the wrong word :)
Ok, great :) I'll try it as soon as my Chromecast feels like booting again
The new chromecast-player version I'm working on will have a simple plugin api (see the dev branch). there for I wanted to create a sample youtube plugin.
I managed to attach the player to an already running youtube session which I started from the browser. I was able todo stuff like play() or pause().
However, I was not able to start the playback of a youtube video. What I found out so far is, that the youtube appId is
233637DE
, the contentId seems to be the youtube-id (e.g.aT5VZBeMz_g
) and the contentType isx-youtube/video
. When trying to load, the Chromecast device returns INVALID_PLAYER_STATE as error.@thibauts do you have any thoughts on this?