mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
remove player object
This commit is contained in:
1 parent
59a8ccce81
commit
59400eb3bf
58 files changed
+295
-313
No files matched your search
@@ -3,7 +3,6 @@ import { clamp, secondToTime, isMobile } from '../utils';
|
||||
export default function gestureInit(art, events) {
|
||||
if (isMobile && !art.option.isLive) {
|
||||
const {
|
||||
player,
|
||||
notice,
|
||||
template: { $video },
|
||||
} = art;
|
||||
@@ -23,14 +22,14 @@ export default function gestureInit(art, events) {
|
||||
if (event.touches.length === 1 && isDroging) {
|
||||
const widthDiff = event.touches[0].clientX - startX;
|
||||
const proportion = clamp(widthDiff / $video.clientWidth, -1, 1);
|
||||
currentTime = clamp(player.currentTime + 60 * proportion, 0, player.duration);
|
||||
notice.show = `${secondToTime(currentTime)} / ${secondToTime(player.duration)}`;
|
||||
currentTime = clamp(art.currentTime + 60 * proportion, 0, art.duration);
|
||||
notice.show = `${secondToTime(currentTime)} / ${secondToTime(art.duration)}`;
|
||||
}
|
||||
});
|
||||
|
||||
events.proxy(document, 'touchend', () => {
|
||||
if (isDroging && currentTime) {
|
||||
player.seek = currentTime;
|
||||
art.seek = currentTime;
|
||||
}
|
||||
isDroging = false;
|
||||
startX = 0;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { throttle } from '../utils';
|
||||
|
||||
export default function resizeInit(art, events) {
|
||||
const { option, player } = art;
|
||||
const { option } = art;
|
||||
|
||||
const resizeFn = throttle(() => {
|
||||
if (player.normalSize) {
|
||||
player.autoSize = option.autoSize;
|
||||
if (art.normalSize) {
|
||||
art.autoSize = option.autoSize;
|
||||
}
|
||||
player.aspectRatioReset = true;
|
||||
art.aspectRatioReset = true;
|
||||
art.emit('resize');
|
||||
}, 500);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function viewInit(art, events) {
|
||||
|
||||
art.on('view', (state) => {
|
||||
if (option.autoMini) {
|
||||
player.mini = !state;
|
||||
art.mini = !state;
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user