Embed: allow options.setTracks to set subtitles
This commit is contained in:
parent
b5750a5de7
commit
06eb78c345
5 changed files with 128 additions and 61 deletions
|
@ -1292,23 +1292,23 @@ MistSkins["default"] = {
|
|||
return MistVideo.player.api.setTrack(type,value);
|
||||
}
|
||||
else {
|
||||
//gather what tracks we should use
|
||||
var usetracks = {};
|
||||
for (var i in selections) {
|
||||
if ((i == "subtitle") || (selections[i].value == "")) { continue; } //subtitle tracks are handled seperately
|
||||
usetracks[i] = selections[i].value;
|
||||
}
|
||||
if (value != ""){ usetracks[type] = value; }
|
||||
//use setTracks
|
||||
if ("setTracks" in MistVideo.player.api) {
|
||||
return MistVideo.player.api.setTracks(usetracks);
|
||||
}
|
||||
//use setSource
|
||||
if ("setSource" in MistVideo.player.api) {
|
||||
return MistVideo.player.api.setSource(
|
||||
MistUtil.http.url.addParam(MistVideo.source.url,usetracks)
|
||||
);
|
||||
}
|
||||
//gather what tracks we should use
|
||||
var usetracks = {};
|
||||
for (var i in selections) {
|
||||
if ((i == "subtitle") || (selections[i].value == "")) { continue; } //subtitle tracks are handled seperately
|
||||
usetracks[i] = selections[i].value;
|
||||
}
|
||||
if (value != ""){ usetracks[type] = value; }
|
||||
//use setTracks
|
||||
if ("setTracks" in MistVideo.player.api) {
|
||||
return MistVideo.player.api.setTracks(usetracks);
|
||||
}
|
||||
//use setSource
|
||||
if ("setSource" in MistVideo.player.api) {
|
||||
return MistVideo.player.api.setSource(
|
||||
MistUtil.http.url.addParam(MistVideo.source.url,usetracks)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1463,8 +1463,12 @@ MistSkins["default"] = {
|
|||
|
||||
|
||||
//add options to the select
|
||||
function n(str) {
|
||||
if (str == "") { return -1; }
|
||||
return Number(str);
|
||||
}
|
||||
var options = MistUtil.object.keys(t,function(a,b){
|
||||
return Number(a) - Number(b);
|
||||
return n(a) - n(b);
|
||||
}); //sort them
|
||||
for (var i in options) {
|
||||
var track = t[options[i]];
|
||||
|
@ -1479,6 +1483,15 @@ MistSkins["default"] = {
|
|||
option.appendChild(document.createTextNode("Track "+(Number(i)+1)));
|
||||
}
|
||||
}
|
||||
|
||||
MistUtil.event.addListener(MistVideo.video,"playerUpdate_trackChanged",function(e){
|
||||
|
||||
if (e.message.type != type) { return; }
|
||||
select.value = e.message.trackid;
|
||||
MistVideo.log("Player selected "+type+" track with id "+e.message.trackid);
|
||||
|
||||
},select);
|
||||
|
||||
if (type == "subtitle") {
|
||||
MistUtil.event.addListener(select,"change",function(){
|
||||
try {
|
||||
|
@ -1538,13 +1551,6 @@ MistSkins["default"] = {
|
|||
}
|
||||
*/
|
||||
|
||||
MistUtil.event.addListener(MistVideo.video,"playerUpdate_trackChanged",function(e){
|
||||
|
||||
if (e.message.type != type) { return; }
|
||||
select.value = e.message.trackid;
|
||||
MistVideo.log("Player selected "+type+" track with id "+e.message.trackid);
|
||||
|
||||
},select);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue