6

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?

1 Answer 1

1

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

5
  • i got it to work for me, if you need help @zposten, let me know and i can try and help Commented Mar 11, 2016 at 21:30
  • I'm getting an error, I believe because I'm adding to the queue without first playing something. Is there an easy way to put it in the PLAYING state and have it play the first piece of media in the queue? "Unexpected command, player is in IDLE state so the media session ID is not valid yet." Commented Mar 14, 2016 at 3:49
  • i had to push one item to the queue from my ios app first, after that i could do whatever i needed on the chromecast. to push the initial item you have to use the queueLoadItems function. Commented Mar 14, 2016 at 14:57
  • @WesleyGormley I am using this plugin github.com/googlecast/CastVideos-chrome can you please help me to create a queue? Commented Mar 2, 2017 at 4:54
  • Hi @WesleyGormley, is it possible to do all of this on the receiver side. I have a similar question but I'm unsure how to apply your solution, as I'm performing everything on the receiver side. Here's a link to my question: stackoverflow.com/questions/43366352/…
    – mhorgan
    Commented Apr 12, 2017 at 15:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.