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