mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 09:41:20 -08:00
add normal mode
This commit is contained in:
1 parent
72937ab1ed
commit
2650acc953
6 files changed
+33
-30
No files matched your search
@@ -4,12 +4,8 @@ export default function resizeInit(art, events) {
|
||||
const { option, player } = art;
|
||||
|
||||
const resizeFn = throttle(() => {
|
||||
if (option.autoSize) {
|
||||
if (!player.fullscreen && !player.fullscreenWeb && !player.fullscreenRotate && !player.pip && !player.min) {
|
||||
player.autoSize = true;
|
||||
} else {
|
||||
player.autoSize = false;
|
||||
}
|
||||
if (player.normal) {
|
||||
player.autoSize = option.autoSize;
|
||||
}
|
||||
player.aspectRatioReset = true;
|
||||
art.emit('resize', {
|
||||
|
||||
@@ -23,16 +23,16 @@ export default function resizeMix(art, player) {
|
||||
setStyle($player, 'width', '100%');
|
||||
setStyle($player, 'height', `${percentage}%`);
|
||||
}
|
||||
art.emit('autoSizeChange', {
|
||||
width: player.width,
|
||||
height: player.height,
|
||||
});
|
||||
} else {
|
||||
removeClass($container, 'art-auto-size');
|
||||
setStyle($player, 'width', null);
|
||||
setStyle($player, 'height', null);
|
||||
art.emit('autoSizeRemove');
|
||||
}
|
||||
|
||||
art.emit('autoSizeChange', {
|
||||
width: player.width,
|
||||
height: player.height,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -86,9 +86,7 @@ export default function eventInit(art, player) {
|
||||
// });
|
||||
|
||||
art.once('video:loadedmetadata', () => {
|
||||
if (option.autoSize) {
|
||||
player.autoSize = true;
|
||||
}
|
||||
player.autoSize = option.autoSize;
|
||||
if (art.isMobile) {
|
||||
art.loading.show = false;
|
||||
art.controls.show = true;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { def } from '../utils';
|
||||
|
||||
export default function exclusiveInit(art, player) {
|
||||
const props = ['min', 'pip', 'fullscreen', 'fullscreenWeb', 'fullscreenRotate'];
|
||||
|
||||
props.forEach((name) => {
|
||||
const event = `${name}Change`;
|
||||
art.on(event, (state) => {
|
||||
@@ -14,4 +17,10 @@ export default function exclusiveInit(art, player) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
def(player, 'normal', {
|
||||
get() {
|
||||
return props.every((name) => !player[name]);
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user