mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
Fix minor bugs and remove loop control
This commit is contained in:
1 parent
4e139ab6f0
commit
cf8cea8283
12 files changed
+407
-569
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user