mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 20:21:20 -08:00
添加字幕切换方法
This commit is contained in:
1 parent
6f84fcc8f2
commit
8d6dcdf6aa
5 files changed
+24
-10
No files matched your search
@@ -31,7 +31,9 @@ export default function switchMix(art, player) {
|
||||
option.url = url;
|
||||
player.playbackRate = false;
|
||||
player.aspectRatio = false;
|
||||
player.currentTime = 0;
|
||||
art.once('video:canplay', () => {
|
||||
player.currentTime = 0;
|
||||
});
|
||||
if (playing) {
|
||||
player.play = true;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ export default class Subtitle {
|
||||
this.state = true;
|
||||
this.isInit = false;
|
||||
const { url } = this.art.option.subtitle;
|
||||
this.switch = this.init.bind(this);
|
||||
if (url) {
|
||||
this.init(url);
|
||||
}
|
||||
@@ -31,6 +32,9 @@ export default class Subtitle {
|
||||
|
||||
this.load(url).then(url => {
|
||||
$subtitle.innerHTML = '';
|
||||
const lastUrl = this.art.template.$track.src;
|
||||
if (lastUrl === url) return;
|
||||
URL.revokeObjectURL(lastUrl);
|
||||
this.art.template.$track.src = url;
|
||||
this.art.emit('subtitle:load', url);
|
||||
|
||||
|
||||
Reference in new issue
Block a user