I am writing a custom receiver for chromecast and was wondering if there is a way we can have our own, custom XHR loader functionality rather then the built in goog.net.XhrIo?
Basically I need to override the functionality of goog.net.XhrIo for all segments/fragments and media files.
I need this to send some beacons back to my servers for analytics.
Thanks!
If you are using the Media Player Library (MPL), then you can use skipRequest() and setResponse() to achieve what you want to do. Note that the Host class provides a number of overrides for updating Segments, Manifest, License and Captions request info.
Related
This says:
A capture device is represented in Media Foundation by a media source object, which exposes the IMFMediaSource interface. In most cases, the application will not use this interface directly, but will use a higher-level API such as the Source Reader to control the capture device.
When I have an IMFMediaSource I can use MFCreateSourceReaderFromMediaSource and create the source reader. However this function fails with MF_E_MULTIPLE_SUBSCRIBERS when I'm also previewing the video I want to capture, which is what I 'd want.
hr = MFCreateSourceReaderFromMediaSource(t.source, 0, &t.rdr); // Fails if I'm previewing, suceeeds when I'm not.
Is there a way to aquire a SourceReader in order to capture video I'm already previewing?
I'm previewing with the Media Session.
Or, if this is not possible, how do I use the IMFMediaSource directly without a source reader? Much like what the embedded Camera application does.
Thanks a lot.
MF_E_MULTIPLE_SUBSCRIBERS part is touched by another question: you cannot have the source managed by Media Session and additionally work with it otherwise.
If you need both you need to either use a tee in that media session and use two legs of the tee to preview and capture.
Alternatively, manage the source yourself and use a custom-developed proxy in the media session to accept data from the source.
Or, if this is not possible, how do I use the IMFMediaSource directly without a source reader? Much like what the embedded Camera application does.
Or just get rid of Media Session, read from media source directly and use the data outside of Media Foundation.
The use pattern is rather straightforward (and repeats what media session or source reader would do on your behalf): create presentation descriptor, set it up, subscrive to events, start, receive samples. This API is fully documented.
I need to implement continuous playback in my google cast custom receiver. For that I am handling the video event 'ended' after playing my first content, and I have to make an API call there to get the next content's media url. And now I am confusing about how can I restart playing with my new content.
Please advice.
Thanks in advance.
You can utilize MediaQueueItem (and .Builder as well) to create queue items before its being played (essentially a playlist itself). RemoteMediaPlayer.queueLoad is already used by the VideoCastManager to load and start a new queue of media items.
I found an example on github for closedcaptions on custom receiver which is about two years old. This example uses sender-receiver communication messageBus to send message to receiver to add a track element to show captions. At that time, chromecast's default media receiver did not support caption track. But as of today, it supports it which can be enabled using chrome.cast.media.Media.editTracksInfo. I tried using editTracksInfo API method to enable captions on my custom receiver which is built using Media Player Library, but it did not work. Can someone please confirm if I still will have to use messageBus to tell my receiver app to create/insert track elements to add captions support to my receiver or can I leverage MPL to automatically do it?
You shouldn't need any custom message; a fully UX compliant receiver sample that supports Closed Captions is available on our GitHub repo. You can use that receiver as the base for your own or you can read through it to see how MPL is utilized to provide closed captions for adaptive media. If you have a simple mp4 + side-loaded vtt file, then MPL doesn't get involved. On the sender side, we now support tracks through the SDK directly; if you want to see a sample of that, take a look at CCL.
It's unclear whether the Timeline features are supported when using only the pebble.js approach (e.g. no C code). Can anyone comment?
Yes, you can use Pebble.js to call regular PebbleKitJS functions (e.g., Pebble.getTimelineToken).
As far as pushing pins to the timeline, pins are pushed via the timeline Web API, which means you can use the ajax function to make a request to the API from within Pebble.js.
I just started using Chromecast SDK today and got bit confused with its APIs and samples given in the web.
What I am trying to do is to send some messages to the Chromecast so it will display them on the big screen. I am going to use Chrome API with HTML5/JS/CSS.
Most examples (https://github.com/pjjanak/chromecast-hello-world/blob/master/sender/index.html , http://nerdwin15.com/2013/10/chromecast-development-part-one-chrome-sender/) in the web uses new Cast.Api() in the sender and uses an Activity in doing so. But I could not find a reference to a Cast.Api in the Chrome API. Most Google references deal with Media and I am not sure whether I have to use them. So to sum up, following are the questions I have (Sorry! I did read the API and developer guide but I am still clueless).
Do I have to write a custom receiver to show text on TV screen. Can't I survive default receiver, chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID
Is handling multimedia files different from displaying text on the Chromecast or can I set the mime type to text/html and send a text stream (doesn't work for me at the moment)
Are those examples on the web uses a deprecated way of sending data to chromecast?
Thanks in advance,
Ish
Ok I think I found the answer from following documents,
https://developers.google.com/cast/docs/receiver_apps
https://github.com/googlecast/CastHelloText-chrome/blob/master/chromehellotext.html
Will try them and let you all know!
Following example page is very useful for anyone who try writing chromecast apps
https://github.com/googlecast
I'm not sure how you fared, but here are some quick responses to your questions.
Yes, you have to write a custom receiver if you want to do anything other than sending images, audio, or video to the Chromecast. You can see a list of supported media Default Media Receiver here: https://developers.google.com/cast/docs/media
Yes (see above), it requires a custom receiver, which will also require your own appId and I'm pretty sure a custom namespace.
To my knowledge, all of the examples up on https://github.com/googlecast should be relevant, but I am working on a few wrappers to try to simplify getting up and running with custom Chrome Sender and Receiver apps. You can check them out here: https://github.com/googlecast Let me know if those help, and if you have any feedback to share.
I hope you've already figured all this stuff out, but if not hopefully this is useful.