Coder Social home page Coder Social logo

youtube example plugin about chromecast-player HOT 17 CLOSED

xat avatar xat commented on May 29, 2024
youtube example plugin

from chromecast-player.

Comments (17)

thibauts avatar thibauts commented on May 29, 2024

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.

from chromecast-player.

xat avatar xat commented on May 29, 2024

Thanks for your input :)
Okay, I'll try sniffing the traffic.

from chromecast-player.

thibauts avatar thibauts commented on May 29, 2024

Let me know what you find

from chromecast-player.

xat avatar xat commented on May 29, 2024

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

from chromecast-player.

thibauts avatar thibauts commented on May 29, 2024

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.

from chromecast-player.

xat avatar xat commented on May 29, 2024

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).

from chromecast-player.

thibauts avatar thibauts commented on May 29, 2024

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.

from chromecast-player.

xat avatar xat commented on May 29, 2024

Hmm, isn't that exactly what I created in that gist already (besides that it needs some small refactorings)?

from chromecast-player.

thibauts avatar thibauts commented on May 29, 2024

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.

from chromecast-player.

xat avatar xat commented on May 29, 2024

okay, I'll give it a shot :)

from chromecast-player.

xat avatar xat commented on May 29, 2024

Would you also suggest creating an separated YoutubeController? Like the MediaController, but with just a load method?

from chromecast-player.

thibauts avatar thibauts commented on May 29, 2024

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.

from chromecast-player.

xat avatar xat commented on May 29, 2024

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

from chromecast-player.

thibauts avatar thibauts commented on May 29, 2024

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.

from chromecast-player.

thibauts avatar thibauts commented on May 29, 2024

It could also be seen as a direct interface to the receiver ... Not so sure about this :)

Great as it is anyway.

from chromecast-player.

xat avatar xat commented on May 29, 2024

too late, renamed to "Youtube". Your totally right.. "receiver" is the wrong word :)

from chromecast-player.

thibauts avatar thibauts commented on May 29, 2024

Ok, great :) I'll try it as soon as my Chromecast feels like booting again

from chromecast-player.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.