This commit is contained in:
Harvey Zack committed 2018-10-19 09:30:37 +08:00
1 parent ca9fa0981b
commit f58684991f
12 files changed
+155 -155

No files matched your search

+11 -2
View File
@@ -1,4 +1,5 @@
import { errorHandle, request, getExt } from './utils';
import ArtPlayerError from './utils/ArtPlayerError';
import { errorHandle, getExt } from './utils';
import config from './config';
export default class Mse {
@@ -93,7 +94,7 @@ export default class Mse {
fetchUrl() {
const { option: { url }, notice, i18n, loading } = this.art;
this.art.emit('player:fetch:start', url);
request(url)
this.request(url)
.then(response => {
this.sourceBuffer.appendBuffer(response);
this.art.emit('player:fetch:success', url);
@@ -109,4 +110,12 @@ export default class Mse {
}
});
}
request(url) {
return fetch(url)
.then(response => response.arrayBuffer())
.catch(err => {
throw new ArtPlayerError(err.message);
});
}
}