mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-30 03:51:25 -08:00
分离事件中心
This commit is contained in:
1 parent
b5694fea89
commit
1d40d1c46b
31 files changed
+728
-403
No files matched your search
@@ -1,16 +1,16 @@
|
||||
import { secondToTime } from '../utils';
|
||||
|
||||
export default function seekMix(art, player) {
|
||||
const { refs: { $video }, notice } = art;
|
||||
const { notice } = art;
|
||||
|
||||
Object.defineProperty(player, 'seek', {
|
||||
value: time => {
|
||||
let newTime = Math.max(time, 0);
|
||||
if ($video.duration) {
|
||||
newTime = Math.min(newTime, $video.duration);
|
||||
if (player.duration) {
|
||||
newTime = Math.min(newTime, player.duration);
|
||||
}
|
||||
$video.currentTime = newTime;
|
||||
notice.show(`${secondToTime(newTime)} / ${secondToTime($video.duration)}`);
|
||||
player.currentTime = newTime;
|
||||
notice.show(`${secondToTime(newTime)} / ${secondToTime(player.duration)}`);
|
||||
art.emit('seek', newTime);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user