mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-13 07:46:17 -08:00
15 lines
388 B
JavaScript
15 lines
388 B
JavaScript
import { clamp, def } from '../utils';
|
|
|
|
export default function currentTimeMix(art) {
|
|
const { $video } = art.template;
|
|
|
|
def(art, 'currentTime', {
|
|
get: () => $video.currentTime || 0,
|
|
set: (time) => {
|
|
time = parseFloat(time);
|
|
if (Number.isNaN(time)) return;
|
|
$video.currentTime = clamp(time, 0, art.duration);
|
|
},
|
|
});
|
|
}
|