mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-19 11:21:20 -08:00
19 lines
436 B
JavaScript
19 lines
436 B
JavaScript
import { secondToTime } from '../utils';
|
|
|
|
export default class Time {
|
|
constructor(option) {
|
|
this.option = option;
|
|
}
|
|
|
|
apply(art, $control) {
|
|
function getTime() {
|
|
$control.innerHTML = `${secondToTime(art.player.currentTime)} / ${secondToTime(art.player.duration)}`;
|
|
}
|
|
|
|
getTime();
|
|
['video:loadedmetadata', 'video:timeupdate', 'video:progress'].forEach(event => {
|
|
art.on(event, getTime);
|
|
});
|
|
}
|
|
}
|