mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 01:56:16 -08:00
18 lines
492 B
JavaScript
18 lines
492 B
JavaScript
import { secondToTime } from '../utils';
|
|
|
|
export default function seekMix(art, player) {
|
|
const { refs: { $video }, notice } = art;
|
|
|
|
Object.defineProperty(player, 'seek', {
|
|
value: time => {
|
|
let newTime = Math.max(time, 0);
|
|
if ($video.duration) {
|
|
newTime = Math.min(newTime, $video.duration);
|
|
}
|
|
$video.currentTime = newTime;
|
|
notice.show(`${secondToTime(newTime)} / ${secondToTime($video.duration)}`);
|
|
art.emit('seek', newTime);
|
|
}
|
|
});
|
|
}
|