mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
update fastForward
This commit is contained in:
1 parent
c5ed370c8b
commit
178c044070
48 files changed
+192
-192
No files matched your search
@@ -2,35 +2,35 @@ import { hasClass, addClass, removeClass } from '../utils';
|
||||
|
||||
export default function fastForward(art) {
|
||||
const {
|
||||
layers,
|
||||
icons,
|
||||
events: { proxy },
|
||||
template: { $player },
|
||||
template: { $player, $video },
|
||||
} = art;
|
||||
|
||||
layers.add({
|
||||
name: 'fast-forward',
|
||||
html: icons.fastForward,
|
||||
mounted($layer) {
|
||||
let isPress = false;
|
||||
let isPress = false;
|
||||
let timer = null;
|
||||
|
||||
proxy($layer, 'touchstart', () => {
|
||||
if (art.playing) {
|
||||
isPress = true;
|
||||
art.playbackRate = 3;
|
||||
addClass($player, 'art-fast-forward');
|
||||
}
|
||||
});
|
||||
const onStart = () => {
|
||||
if (art.playing) {
|
||||
timer = setTimeout(() => {
|
||||
isPress = true;
|
||||
art.playbackRate = 3;
|
||||
addClass($player, 'art-fast-forward');
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
|
||||
proxy(document, 'touchend', () => {
|
||||
if (isPress) {
|
||||
isPress = false;
|
||||
art.playbackRate = 1;
|
||||
removeClass($player, 'art-fast-forward');
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
const onStop = () => {
|
||||
clearTimeout(timer);
|
||||
if (isPress) {
|
||||
isPress = false;
|
||||
art.playbackRate = 1;
|
||||
removeClass($player, 'art-fast-forward');
|
||||
}
|
||||
};
|
||||
|
||||
proxy($video, 'touchstart', onStart);
|
||||
proxy(document, 'touchmove', onStop);
|
||||
proxy(document, 'touchend', onStop);
|
||||
|
||||
return {
|
||||
name: 'fastForward',
|
||||
|
||||
Reference in new issue
Block a user