Files
ArtPlayer/packages/artplayer/src/player/stateMix.js
T
2023-09-01 21:14:10 +08:00

17 lines
503 B
JavaScript

import { def } from '../utils';
export default function stateMix(art) {
const states = ['mini', 'pip', 'fullscreen', 'fullscreenWeb'];
def(art, 'state', {
get: () => states.find((name) => art[name]) || 'standard',
set(name) {
for (let index = 0; index < states.length; index++) {
const prop = states[index];
if (prop !== name && art[prop]) {
art[prop] = false;
}
}
},
});
}