add more event

This commit is contained in:
Harvey Zack committed 2018-10-18 11:17:37 +08:00
1 parent b2159e7d4d
commit 506b34522b
14 files changed
+202 -77

No files matched your search

+15 -4
View File
@@ -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);
}
}