Fix minor bugs and remove loop control

This commit is contained in:
Harvey Zack committed 2023-11-11 10:20:45 +08:00
1 parent 4e139ab6f0
commit cf8cea8283
12 files changed
+407 -569

No files matched your search

-2
View File
@@ -21,7 +21,6 @@ import autoSizeMix from './autoSizeMix';
import rectMix from './rectMix';
import flipMix from './flipMix';
import miniMix from './miniMix';
import loopMix from './loopMix';
import posterMix from './posterMix';
import autoHeightMix from './autoHeightMix';
import cssVarMix from './cssVarMix';
@@ -59,7 +58,6 @@ export default class Player {
rectMix(art);
flipMix(art);
miniMix(art);
loopMix(art);
posterMix(art);
autoHeightMix(art);
cssVarMix(art);
-30
View File
@@ -1,30 +0,0 @@
import { def, clamp } from '../utils';
export default function loopMix(art) {
let interval = [];
def(art, 'loop', {
get: () => interval,
set: (value) => {
if (Array.isArray(value) && typeof value[0] === 'number' && typeof value[1] === 'number') {
const start = clamp(value[0], 0, Math.min(value[1], art.duration));
const end = clamp(value[1], start, art.duration);
if (end - start >= 1) {
interval = [start, end];
} else {
interval = [];
}
} else {
interval = [];
}
art.emit('loop', interval);
},
});
art.on('video:timeupdate', () => {
if (interval.length) {
if (art.currentTime < interval[0] || art.currentTime > interval[1]) {
art.seek = interval[0];
}
}
});
}