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

+5 -2
View File
@@ -91,10 +91,12 @@ export default class Mse {
}
fetchUrl() {
const { option, notice, i18n, loading } = this.art;
request(option.url)
const { option: { url }, notice, i18n, loading } = this.art;
this.art.emit('player:fetch:start', url);
request(url)
.then(response => {
this.sourceBuffer.appendBuffer(response);
this.art.emit('player:fetch:success', url);
})
.catch(err => {
if (this.repeat++ < this.maxRepeat) {
@@ -103,6 +105,7 @@ export default class Mse {
notice.show(i18n.get('Video load failed'));
console.warn(err);
loading.hide();
this.art.emit('player:fetch:failure', url);
}
});
}