mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-18 19:01:20 -08:00
添加切换视频源
This commit is contained in:
1 parent
3e87417f82
commit
5fcff320cf
7 files changed
+98
-42
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user