共计 1224 个字符,预计需要花费 4 分钟才能阅读完成。
转载自 github:https://github.com/bilibili/flv.js/pull/448/files
,
避免失落记录, 要批改源码:
@@ -117,6 +117,12 @@ class FetchStreamLoader extends BaseLoader {params.referrerPolicy \= dataSource.referrerPolicy;}
// add abort controller, by wmlgl 2019-5-10 12:21:27
if (self.AbortController) {this.\_abortController \= new self.AbortController();
params.signal \= this.\_abortController.signal;
}
this.\_status \= LoaderStatus.kConnecting;
self.fetch(seekConfig.url, params).then((res) \=> {if (this.\_requestAbort) {[](https://github.com/bilibili/flv.js/pull/448/files#diff-2236408d6aad747aed1a901e3aac73fe "Expand Down")[](https://github.com/bilibili/flv.js/pull/448/files#diff-2236408d6aad747aed1a901e3aac73fe "Expand Up")
@@ -152,6 +158,10 @@ class FetchStreamLoader extends BaseLoader {}}
}).catch((e) \=> {if (this.\_abortController && this.\_abortController.signal.aborted) {return;}
this.\_status \= LoaderStatus.kError;
if (this.\_onError) {this.\_onError(LoaderErrors.EXCEPTION, {code: \-1, msg: e.message});
[](https://github.com/bilibili/flv.js/pull/448/files#diff-2236408d6aad747aed1a901e3aac73fe "Expand All")
@@ -163,6 +173,10 @@ class FetchStreamLoader extends BaseLoader {abort() {
this.\_requestAbort \= true;
if (this.\_abortController) {this.\_abortController.abort();
}
}
\_pump(reader) { // ReadableStreamReader
相干评论:
正文完