Embed:
- updated videojs and dashjs - combo selection algorithm now tries to find maximum simultracks - when requesting stream info, add ?metaeverywhere=1 to the url to not count meta/subtitle tracks to simul_tracks and source priority sorting - updated videojs, dashjs and hlsjs players - improved html5 codec support testing - urlappend: improved behaviour when url already contains search params
This commit is contained in:
parent
6d86f98148
commit
eee3595d46
26 changed files with 452 additions and 185 deletions
|
@ -19,22 +19,49 @@ mistplayers.dashjs = {
|
|||
return false;
|
||||
}
|
||||
|
||||
var codecs = {};
|
||||
if (!("MediaSource" in window)) { return false; }
|
||||
if (!MediaSource.isTypeSupported) { return true; } //we can't ask, but let's assume something will work
|
||||
|
||||
//check if both audio and video have at least one playable track
|
||||
//gather track types and codec strings
|
||||
var playabletracks = {};
|
||||
var hassubtitles = false;
|
||||
for (var i in MistVideo.info.meta.tracks) {
|
||||
if (MistVideo.info.meta.tracks[i].type != "meta") {
|
||||
codecs[MistVideo.info.meta.tracks[i].codec] = 1;
|
||||
if (MistVideo.info.meta.tracks[i].type == "meta") {
|
||||
if (MistVideo.info.meta.tracks[i].codec == "subtitle") { hassubtitles = true; }
|
||||
continue;
|
||||
}
|
||||
}
|
||||
codecs = MistUtil.object.keys(codecs);
|
||||
//if there's a h265 track, remove it from the list of codecs
|
||||
for (var i = codecs.length-1; i >= 0; i--) {
|
||||
if (codecs[i].substr(0,4) == "HEVC") {
|
||||
codecs.splice(i,1);
|
||||
if (!(MistVideo.info.meta.tracks[i].type in playabletracks)) {
|
||||
playabletracks[MistVideo.info.meta.tracks[i].type] = {};
|
||||
}
|
||||
playabletracks[MistVideo.info.meta.tracks[i].type][MistUtil.tracks.translateCodec(MistVideo.info.meta.tracks[i])] = 1;
|
||||
}
|
||||
if (codecs.length < source.simul_tracks) { return false; } //if there's no longer enough playable tracks, skip this player
|
||||
|
||||
return ("MediaSource" in window);
|
||||
var tracktypes = [];
|
||||
for (var type in playabletracks) {
|
||||
var playable = false;
|
||||
|
||||
for (var codec in playabletracks[type]) {
|
||||
if (MediaSource.isTypeSupported("video/mp4;codecs=\""+codec+"\"")) {
|
||||
playable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (playable) {
|
||||
tracktypes.push(type);
|
||||
}
|
||||
}
|
||||
if (hassubtitles) {
|
||||
//there is a subtitle track, check if there is a webvtt source
|
||||
for (var i in MistVideo.info.source) {
|
||||
if (MistVideo.info.source[i].type == "html5/text/vtt") {
|
||||
tracktypes.push("subtitle");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tracktypes.length ? tracktypes : false;
|
||||
},
|
||||
player: function(){this.onreadylist = [];},
|
||||
scriptsrc: function(host) { return host+"/dashjs.js"; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue