添加切换视频源

This commit is contained in:
Harvey Zack committed 2018-11-01 10:03:55 +08:00
1 parent 3e87417f82
commit 5fcff320cf
7 files changed
+98 -42

No files matched your search

+12
View File
@@ -165,6 +165,18 @@ export default class Player {
return this.art.refs.$video.duration || 0;
}
switch(url, name = 'Unknown') {
const { refs: { $video }, i18n, notice, isPlaying } = this.art;
const currentTime = this.currentTime();
$video.src = url;
this.seek(currentTime);
if (isPlaying) {
this.play();
}
notice.show(`${i18n.get('Switch')}: ${name}`);
this.art.emit('switch', url);
}
playbackRate(rate) {
const { refs: { $video, $player }, i18n, notice } = this.art;
const newRate = clamp(rate, 0.1, 10);