update gestureInit

This commit is contained in:
Harvey committed 2022-03-10 18:22:40 +08:00
1 parent b4500e701f
commit 3a3246ee3f
5 files changed
+23 -20

No files matched your search

+7 -5
View File
@@ -1,7 +1,7 @@
import { clamp, secondToTime, isMobile } from '../utils';
export default function gestureInit(art, events) {
if (isMobile && !art.option.isLive) {
if (isMobile && !art.option.isLive && art.duration) {
const {
notice,
template: { $video },
@@ -15,6 +15,7 @@ export default function gestureInit(art, events) {
if (event.touches.length === 1) {
isDroging = true;
startX = event.touches[0].clientX;
art.playbackRate = 3;
}
});
@@ -28,12 +29,13 @@ export default function gestureInit(art, events) {
});
events.proxy(document, 'touchend', () => {
if (isDroging && currentTime) {
if (isDroging) {
art.seek = currentTime;
art.playbackRate = 1;
startX = 0;
currentTime = 0;
isDroging = false;
}
isDroging = false;
startX = 0;
currentTime = 0;
});
}
}
@@ -14,7 +14,7 @@ export default function playbackRateMix(art) {
set(rate) {
if (rate) {
if (rate === $video.playbackRate) return;
const rateList = [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0];
const rateList = [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 3.0, 4.0];
errorHandle(rateList.includes(rate), `'playbackRate' only accept ${rateList.toString()} as parameters`);
$video.playbackRate = rate;
notice.show = `${i18n.get('Rate')}: ${rate === 1.0 ? i18n.get('Normal') : `${rate}x`}`;