mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-18 19:01:20 -08:00
add fastForward
This commit is contained in:
1 parent
17262ff63d
commit
3b63e1a59b
58 files changed
+309
-150
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { hasClass, addClass, removeClass } from '../utils';
|
||||
|
||||
export default function fastForward(art) {
|
||||
const {
|
||||
layers,
|
||||
icons,
|
||||
events: { proxy },
|
||||
template: { $player },
|
||||
} = art;
|
||||
|
||||
layers.add({
|
||||
name: 'fast-forward',
|
||||
html: icons.fastForward,
|
||||
mounted($layer) {
|
||||
let isPress = false;
|
||||
|
||||
proxy($layer, 'touchstart', () => {
|
||||
isPress = true;
|
||||
art.playbackRate = 3;
|
||||
addClass($player, 'art-fast-forward');
|
||||
});
|
||||
|
||||
proxy(document, 'touchend', () => {
|
||||
if (isPress) {
|
||||
isPress = false;
|
||||
art.playbackRate = 1;
|
||||
removeClass($player, 'art-fast-forward');
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
name: 'fastForward',
|
||||
get state() {
|
||||
return hasClass($player, 'art-fast-forward');
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { errorHandle, isMobile, has, def } from '../utils';
|
||||
import miniProgressBar from './miniProgressBar';
|
||||
import autoOrientation from './autoOrientation';
|
||||
import autoPlayback from './autoPlayback';
|
||||
import fastForward from './fastForward';
|
||||
import lock from './lock';
|
||||
|
||||
export default class Plugins {
|
||||
@@ -27,6 +28,10 @@ export default class Plugins {
|
||||
this.add(autoOrientation);
|
||||
}
|
||||
|
||||
if (option.fastForward && isMobile) {
|
||||
this.add(fastForward);
|
||||
}
|
||||
|
||||
for (let index = 0; index < option.plugins.length; index++) {
|
||||
this.add(option.plugins[index]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user