mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
简化工具函数
This commit is contained in:
1 parent
be4d1d0437
commit
1270167a3e
26 files changed
+182
-152
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { append, setStyle, addClass, removeClass, hasClass } from '../utils';
|
||||
import { append, setStyle, addClass, removeClass, hasClass, def } from '../utils';
|
||||
|
||||
function nativePip(art, player) {
|
||||
const {
|
||||
@@ -9,7 +9,7 @@ function nativePip(art, player) {
|
||||
|
||||
$video.disablePictureInPicture = false;
|
||||
|
||||
Object.defineProperty(player, 'pip', {
|
||||
def(player, 'pip', {
|
||||
get() {
|
||||
return document.pictureInPictureElement;
|
||||
},
|
||||
@@ -48,7 +48,7 @@ function webkitPip(art, player) {
|
||||
|
||||
$video.webkitSetPresentationMode('inline');
|
||||
|
||||
Object.defineProperty(player, 'pip', {
|
||||
def(player, 'pip', {
|
||||
get() {
|
||||
return $video.webkitPresentationMode === 'picture-in-picture';
|
||||
},
|
||||
@@ -140,7 +140,7 @@ function customPip(art, player) {
|
||||
},
|
||||
};
|
||||
|
||||
Object.defineProperty(player, 'pip', property);
|
||||
def(player, 'pip', property);
|
||||
}
|
||||
|
||||
export default function pipMix(art, player) {
|
||||
@@ -153,7 +153,7 @@ export default function pipMix(art, player) {
|
||||
customPip(art, player);
|
||||
}
|
||||
|
||||
Object.defineProperty(player, 'pipToggle', {
|
||||
def(player, 'pipToggle', {
|
||||
set(value) {
|
||||
if (value) {
|
||||
player.pip = !player.pip;
|
||||
|
||||
Reference in new issue
Block a user