google cast - ChromeCast TTML Closed Captioning with Smooth Streaming and PlayReady -
hy!
i create application supports ttml typed closed captions.
my ism/manifest file contains ttml based closed caption, ask how can use it?
i found site, https://developers.google.com/cast/docs/player described following:
segmented ttml & webvtt
use segmented ttml smooth streaming , webvtt - web video text tracks hls.
to enable:
protocol_.enablestream(streamindex, true); player_.enablecaptions(true);
but can't find example problem. have enable after creating host @ receiver side? there sample app this?
update #1
here's code:
window.onload = function() { var mediaelement = document.getelementbyid('video'); //video html video tag var mediamanager = new cast.receiver.mediamanager(mediaelement); var url = "http://playready.directtaps.net/smoothstreaming/sswss720h264/superspeedway_720.ism/manifest"; //just sample url var host = new cast.player.api.host({ 'mediaelement': mediaelement, 'url': url }); window.player = new cast.player.api.player(host); protocol = cast.player.api.createsmoothstreamingprotocol(host); var initstart = 0; window.player.load(protocol, initstart); mediamanager.loadedmetadata = function(loadinfo) { //onmetadataloaded fired, set caption } }
it doesn't work. decided streams:
var streamcount = protocol.getstreamcount();
and streamcount contains 0. manifest contains closed caption, should use else, not getstreamcount()?
thank much!
the correct approach listen metadataloaded event. once event fired, stream count, don't before event fired. can enable stream index want (for language want, in case have multiple ones) , enable caption. if want change language, first need disable caption , select different stream index , enable again.
Comments
Post a Comment