Embed: HLS trackswitching now default, improvements to no audio/video-checkboxes
This commit is contained in:
parent
6ff35446ae
commit
017e28932a
3 changed files with 24 additions and 26 deletions
File diff suppressed because one or more lines are too long
|
@ -742,30 +742,7 @@ function MistVideo(streamName,options) {
|
|||
//if (!MistUtil.object.keys(usetracks).length) { return; } //don't do this; allow switching back to auto
|
||||
|
||||
//create source url
|
||||
var newurl;
|
||||
if (MistVideo.source.type == "html5/application/vnd.apple.mpegurl") { //for HLS, use a different format for track selection
|
||||
newurl = MistVideo.source.url.split("/");
|
||||
var m3u8 = newurl.pop(); //take this off now, it will be added back later
|
||||
var hlstracks = [];
|
||||
for (var i in usetracks) {
|
||||
//for audio or video tracks, just add the tracknumber between slashes
|
||||
switch (i) {
|
||||
case "audio":
|
||||
case "video":
|
||||
if (usetracks[i] == "none") { continue; }
|
||||
hlstracks.push(usetracks[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hlstracks.length) { newurl.push(hlstracks.join("_")); }
|
||||
newurl.push(m3u8); //put back index.m3u8
|
||||
newurl = newurl.join("/");
|
||||
usetracks = {};
|
||||
}
|
||||
else {
|
||||
newurl = MistVideo.source.url;
|
||||
}
|
||||
|
||||
var newurl = MistVideo.source.url;
|
||||
var time = MistVideo.player.api.currentTime;
|
||||
|
||||
//actually switch to the new source url
|
||||
|
|
|
@ -1291,6 +1291,9 @@ MistSkins["default"] = {
|
|||
|
||||
if (!MistVideo.options.setTracks) { MistVideo.options.setTracks = {}; }
|
||||
MistVideo.options.setTracks[type] = value;
|
||||
if ((value === true) && selections[type]) {
|
||||
MistUtil.event.send("change",null,selections[type]);
|
||||
}
|
||||
|
||||
if ("setTrack" in MistVideo.player.api) {
|
||||
return MistVideo.player.api.setTrack(type,value);
|
||||
|
@ -1378,6 +1381,15 @@ MistSkins["default"] = {
|
|||
cell.appendChild(checkbox);
|
||||
checkboxes[type] = checkbox;
|
||||
|
||||
if (MistVideo.options.setTracks && (MistVideo.options.setTracks[type])) {
|
||||
if (MistVideo.options.setTracks[type] == "none") {
|
||||
checkbox.checked = false;
|
||||
}
|
||||
else {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
MistUtil.event.addListener(checkbox,"change",function(){
|
||||
//make sure at least one checkbox is checked
|
||||
var n = 0;
|
||||
|
@ -1411,6 +1423,15 @@ MistSkins["default"] = {
|
|||
}
|
||||
changeToTracks(this.trackType,(this.checked ? value : "none"));
|
||||
});
|
||||
|
||||
MistUtil.event.addListener(MistVideo.video,"playerUpdate_trackChanged",function(e){
|
||||
|
||||
if (e.message.type != type) { return; }
|
||||
|
||||
if (e.message.value == "none") { this.checked = false; }
|
||||
else { this.checked = true; }
|
||||
|
||||
},select);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1490,7 +1511,7 @@ MistSkins["default"] = {
|
|||
|
||||
MistUtil.event.addListener(MistVideo.video,"playerUpdate_trackChanged",function(e){
|
||||
|
||||
if (e.message.type != type) { return; }
|
||||
if ((e.message.type != type) || (e.message.trackid == "none")) { return; }
|
||||
select.value = e.message.trackid;
|
||||
MistVideo.log("Player selected "+type+" track with id "+e.message.trackid);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue