mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
add more event
This commit is contained in:
1 parent
b2159e7d4d
commit
506b34522b
14 files changed
+202
-77
No files matched your search
+15
-4
@@ -40,23 +40,34 @@ export default class Subtitle {
|
||||
.map(item => `<p>${item}</p>`)
|
||||
.join('');
|
||||
}
|
||||
this.art.emit('subtitle:update', $subtitle);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
show() {
|
||||
this.art.refs.$subtitle.style.display = 'block';
|
||||
const { refs: { $subtitle } } = this.art;
|
||||
$subtitle.style.display = 'block';
|
||||
this.art.emit('subtitle:show', $subtitle);
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.art.refs.$subtitle.style.display = 'none';
|
||||
const { refs: { $subtitle } } = this.art;
|
||||
$subtitle.style.display = 'none';
|
||||
this.art.emit('subtitle:hide', $subtitle);
|
||||
}
|
||||
|
||||
change(url) {
|
||||
switch(url) {
|
||||
const { refs: { $track } } = this.art;
|
||||
errorHandle(
|
||||
getExt(url) === 'vtt',
|
||||
`'url' option require 'vtt' format, but got '${getExt(url)}'.`
|
||||
);
|
||||
this.art.refs.$track.src = url;
|
||||
errorHandle(
|
||||
$track,
|
||||
'You need to initialize the subtitle option first.'
|
||||
);
|
||||
$track.src = url;
|
||||
this.art.emit('subtitle:switch', url);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user