Update currentTimeMix.js

This commit is contained in:
zhw2590582 committed 2020-03-15 07:43:15 +08:00
1 parent 3b0f500438
commit bb92f3dc3d
1 file changed
+5 -3
@@ -1,10 +1,12 @@
import { clamp, def } from '../utils';
export default function currentTimeMix(art, player) {
const { $video } = art.template;
def(player, 'currentTime', {
get: () => art.template.$video.currentTime || 0,
set: currentTime => {
art.template.$video.currentTime = clamp(currentTime, 0, player.duration);
get: () => $video.currentTime || 0,
set: time => {
$video.currentTime = clamp(time, 0, player.duration || Infinity);
},
});
}