mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
set right playbackrate after fastforward on mobile
This commit is contained in:
1 parent
2cf2a464b9
commit
07c206ab89
1 file changed
+3
-1
@@ -9,11 +9,13 @@ export default function fastForward(art) {
|
|||||||
|
|
||||||
let timer = null;
|
let timer = null;
|
||||||
let isPress = false;
|
let isPress = false;
|
||||||
|
let lastPlaybackRate = 1;
|
||||||
|
|
||||||
const onStart = (event) => {
|
const onStart = (event) => {
|
||||||
if (event.touches.length === 1 && art.playing && !art.isLock) {
|
if (event.touches.length === 1 && art.playing && !art.isLock) {
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
isPress = true;
|
isPress = true;
|
||||||
|
lastPlaybackRate = art.playbackRate;
|
||||||
art.playbackRate = constructor.FAST_FORWARD_VALUE;
|
art.playbackRate = constructor.FAST_FORWARD_VALUE;
|
||||||
addClass($player, 'art-fast-forward');
|
addClass($player, 'art-fast-forward');
|
||||||
}, constructor.FAST_FORWARD_TIME);
|
}, constructor.FAST_FORWARD_TIME);
|
||||||
@@ -24,7 +26,7 @@ export default function fastForward(art) {
|
|||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
if (isPress) {
|
if (isPress) {
|
||||||
isPress = false;
|
isPress = false;
|
||||||
art.playbackRate = 1;
|
art.playbackRate = lastPlaybackRate;
|
||||||
removeClass($player, 'art-fast-forward');
|
removeClass($player, 'art-fast-forward');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user