safari 支持画中画模式

This commit is contained in:
zhw2590582 committed 2019-05-09 20:37:27 +08:00
1 parent cca41ae1fe
commit 524c3203ef
3 files changed
+54 -1

No files matched your search

+26
View File
@@ -3079,6 +3079,28 @@
});
}
function webkitPip(art, player) {
var $video = art.template.$video;
$video.webkitSetPresentationMode('inline');
Object.defineProperty(player, 'pipState', {
get: function get() {
return $video.webkitPresentationMode === 'picture-in-picture';
}
});
Object.defineProperty(player, 'pipEnabled', {
value: function value() {
$video.webkitSetPresentationMode('picture-in-picture');
art.emit('pipEnabled');
}
});
Object.defineProperty(player, 'pipExit', {
value: function value() {
$video.webkitSetPresentationMode('inline');
art.emit('pipExit');
}
});
}
function customPip(art, player) {
var option = art.option,
i18n = art.i18n,
@@ -3144,8 +3166,12 @@
}
function pipMix(art, player) {
var $video = art.template.$video;
if (document.pictureInPictureEnabled) {
nativePip(art, player);
} else if ($video.webkitSupportsPresentationMode && typeof $video.webkitSetPresentationMode === 'function') {
webkitPip(art, player);
} else {
customPip(art, player);
}