xgplayer-streaming-shared
Advanced tools
Comparing version 3.0.0-alpha.3 to 3.0.0-alpha.4
@@ -13,4 +13,6 @@ export class FetchLoader { | ||
_logger: any; | ||
load({ url, timeout, responseType, onProgress, index, onTimeout, range, transformResponse, request, params, logger, method, headers, body, mode, credentials, cache, redirect, referrer, referrerPolicy, integrity }: { | ||
_vid: string; | ||
load({ url, vid, timeout, responseType, onProgress, index, onTimeout, range, transformResponse, request, params, logger, method, headers, body, mode, credentials, cache, redirect, referrer, referrerPolicy, integrity }: { | ||
url: any; | ||
vid: any; | ||
timeout: any; | ||
@@ -41,2 +43,3 @@ responseType: any; | ||
range: any; | ||
vid: any; | ||
index: any; | ||
@@ -43,0 +46,0 @@ contentLength: any; |
@@ -60,2 +60,4 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator'; | ||
_defineProperty(this, "_logger", null); | ||
_defineProperty(this, "_vid", ''); | ||
} | ||
@@ -69,2 +71,3 @@ | ||
var url = _ref.url, | ||
vid = _ref.vid, | ||
timeout = _ref.timeout, | ||
@@ -96,2 +99,3 @@ responseType = _ref.responseType, | ||
this._range = range || [0, 0]; | ||
this._vid = vid || url; | ||
@@ -227,3 +231,3 @@ this._logger.debug('【fetchLoader task】, range', this._range); | ||
_this._running = false; | ||
return _context.abrupt("return", createResponse(data, true, response, response.headers.get('Content-Length'), response.headers.get('age'), startTime, firstByteTime, index, range)); | ||
return _context.abrupt("return", createResponse(data, true, response, response.headers.get('Content-Length'), response.headers.get('age'), startTime, firstByteTime, index, range, _this._vid)); | ||
@@ -359,2 +363,3 @@ case 30: | ||
range: _this2._range, | ||
vid: _this2._vid, | ||
index: _this2._index, | ||
@@ -374,2 +379,3 @@ startTime: startTime, | ||
range: _this2._range, | ||
vid: _this2._vid, | ||
index: _this2._index, | ||
@@ -390,2 +396,3 @@ startTime: startTime, | ||
range: [startByte, _this2._range[0] + _this2._receivedLength], | ||
vid: _this2._vid, | ||
index: _this2._index, | ||
@@ -392,0 +399,0 @@ startTime: startTime, |
export function getRangeValue(value: any): string; | ||
export function setUrlParams(url: any, params: any): any; | ||
export function createResponse(data: any, done: any, response: any, contentLength: any, age: any, startTime: any, firstByteTime: any, index: any, range: any): { | ||
export function createResponse(data: any, done: any, response: any, contentLength: any, age: any, startTime: any, firstByteTime: any, index: any, range: any, vid: any): { | ||
data: any; | ||
@@ -8,2 +8,3 @@ done: any; | ||
range: any; | ||
vid: any; | ||
index: any; | ||
@@ -10,0 +11,0 @@ contentLength: any; |
@@ -62,3 +62,3 @@ import 'core-js/modules/es.regexp.exec.js'; | ||
} | ||
function createResponse(data, done, response, contentLength, age, startTime, firstByteTime, index, range) { | ||
function createResponse(data, done, response, contentLength, age, startTime, firstByteTime, index, range, vid) { | ||
age = age != null ? parseFloat(age) : null; | ||
@@ -69,2 +69,3 @@ contentLength = parseInt(contentLength || '0', 10); | ||
range: range, | ||
vid: vid, | ||
index: index, | ||
@@ -71,0 +72,0 @@ contentLength: contentLength, |
@@ -25,2 +25,3 @@ export class XhrLoader { | ||
_logger: boolean; | ||
_vid: string; | ||
load(req: any): Promise<any>; | ||
@@ -27,0 +28,0 @@ _openSubRange(): void; |
@@ -104,2 +104,4 @@ import 'core-js/modules/es.function.name.js'; | ||
_defineProperty(this, "_logger", false); | ||
_defineProperty(this, "_vid", ''); | ||
} | ||
@@ -138,2 +140,3 @@ | ||
this._runing = true; | ||
this._vid = req.vid || url; | ||
this._url = setUrlParams(url, params); | ||
@@ -228,3 +231,3 @@ var startTime = Date.now(); | ||
_this._runing = false; | ||
resolve(createResponse(data, true, response, response.headers['content-length'], response.headers.age, startTime, firstByteTime, index, _this._range)); | ||
resolve(createResponse(data, true, response, response.headers['content-length'], response.headers.age, startTime, firstByteTime, index, _this._range, _this._vid)); | ||
} | ||
@@ -316,3 +319,3 @@ } | ||
if (status < 200 || status > 299) { | ||
this._loadCompleteReject(new NetError(url, null, e.target.response, 'bad response,status:' + status)); | ||
this._loadCompleteReject(new NetError(this._url, null, e.target.response, 'bad response,status:' + status)); | ||
} | ||
@@ -360,2 +363,3 @@ | ||
index: this._index, | ||
vid: this._vid, | ||
range: [byteStart, this._range[0] + this._receivedLength], | ||
@@ -379,3 +383,3 @@ startTime: this._startTime, | ||
}; | ||
this._loadCompleteResolve && this._loadCompleteResolve(createResponse(null, true, response, response.headers['content-length'], response.headers.age, this._startTime, this._firstByteTime, this._index, this._range)); | ||
this._loadCompleteResolve && this._loadCompleteResolve(createResponse(null, true, response, response.headers['content-length'], response.headers.age, this._startTime, this._firstByteTime, this._index, this._range, this._vid)); | ||
} | ||
@@ -382,0 +386,0 @@ } |
{ | ||
"name": "xgplayer-streaming-shared", | ||
"version": "3.0.0-alpha.3", | ||
"version": "3.0.0-alpha.4", | ||
"main": "dist/index.min.js", | ||
@@ -5,0 +5,0 @@ "module": "es/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
782503
3273
4