Embed: on android <7, let videojs override native hls playback

This commit is contained in:
Cat 2020-01-23 12:50:44 +01:00 committed by Thulinma
parent b5fcc4647c
commit 01b957d136
6 changed files with 28 additions and 4 deletions

View file

@ -18,6 +18,14 @@ mistplayers.html5 = {
}
}
if (mimetype == "html5/application/vnd.apple.mpegurl") {
var android = MistUtil.getAndroid();
if (android && (parseFloat(android) < 7)) {
MistVideo.log("Skipping native HLS as videojs will do better");
return false;
}
}
var support = false;
var shortmime = mimetype.split("/");

View file

@ -82,6 +82,19 @@ p.prototype.build = function (MistVideo,callback) {
vjsopts.controls = false;
}
//for android < 7, enable override native
function androidVersion(){
var match = navigator.userAgent.toLowerCase().match(/android\s([\d\.]*)/i);
return match ? match[1] : false;
}
var android = MistUtil.getAndroid();
if (android && (parseFloat(android) < 7)) {
MistVideo.log("Detected android < 7: instructing videojs to override native playback");
vjsopts.html5 = {hls: {overrideNative: true}};
vjsopts.nativeAudioTracks = false;
vjsopts.nativeVideoTracks = false;
}
me.onready(function(){
MistVideo.log("Building videojs");
me.videojs = videojs(ele,vjsopts,function(){
@ -160,7 +173,6 @@ p.prototype.build = function (MistVideo,callback) {
MistVideo.player.api.load = function(){};
overrides.set.currentTime = function(value){
console.log("seeking to",value);
MistVideo.player.videojs.currentTime(value); //seeking backwards does not work if we set it on the video directly
//MistVideo.video.currentTime = value;
};