android - Google Cast - Subtitles with the Styled Media Receiver? -


i'm using styled media receiver. have url webvtt subtitles video, , want give them receiver display them, can't find way in api docs.

i'm using styled media receiver because javascript/html weak, haven't found way send subtitles android sender without using media player library.

check out sample code own closed caption in receiver app if don't need/want use media player lib.

https://github.com/googlecast/castclosedcaptioning-chrome/blob/master/closedcaptioningreceiver.html

window.showtracks = function() {   console.log('showtracks activetrackindex='+window.activetrackindex+'    if (window.activetrackindex != undefined &&       window.activetrackindex >= 0 &&       window.activetrackindex < window.tracks.length) {     var trackelement = document.createelement('track');     trackelement.src = window.tracks[window.activetrackindex]['src'];     console.log('showtracks trackelement.src='+trackelement.src);     if (window.mediaelement.firstchild) {       window.mediaelement.replacechild(           trackelement, window.mediaelement.firstchild);     } else {       window.mediaelement.appendchild(trackelement);     }     window.mediaelement['texttracks'][0].mode = 'showing';   } else {     window.mediaelement['texttracks'] = null;     window.mediaelement.innerhtml = null;   } }; 

the cc web vtt file passed custom data chrome sender can using android sender well.

    var customdata = event.data['customdata'];     if (customdata && customdata['cc']) {       tracks = customdata['cc']['tracks'];       window.activetrackindex = customdata['cc']['active'];       showtracks();     } 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -