- 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:
Cat 2022-09-07 11:07:44 +02:00 committed by Thulinma
parent 6d86f98148
commit eee3595d46
26 changed files with 452 additions and 185 deletions

View file

@ -19,22 +19,63 @@ mistplayers.videojs = {
return false;
}
var codecs = {};
for (var i in MistVideo.info.meta.tracks) {
if (MistVideo.info.meta.tracks[i].type != "meta") {
codecs[MistVideo.info.meta.tracks[i].codec] = 1;
function checkPlaybackOfTrackTypes(mime) {
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") {
if (MistVideo.info.meta.tracks[i].codec == "subtitle") { hassubtitles = true; }
continue;
}
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;
}
}
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);
var tracktypes = [];
for (var type in playabletracks) {
var playable = false;
for (var codec in playabletracks[type]) {
if (MediaSource.isTypeSupported(mime+";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;
}
if (codecs.length < source.simul_tracks) { return false; } //if there's no longer enough playable tracks, skip this player
return ("MediaSource" in window);
//can this browser play this natively?
if (document.createElement("video").canPlayType(mimetype.replace("html5/",""))) {
//we can't ask, but let's assume something will work
if (!("MediaSource" in window)) { return true; }
if (!MediaSource.isTypeSupported) { return true; }
return checkPlaybackOfTrackTypes(mimetype.replace("html5/",""));
}
if (!("MediaSource" in window)) { return false; }
return checkPlaybackOfTrackTypes("video/mp4");
},
player: function(){},
scriptsrc: function(host) { return host+"/videojs.js"; }