Chromecast receiver, how to load media without exp

2019-01-26 22:04发布

问题:

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:

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