xgplayer-streaming-shared
Advanced tools
Comparing version 3.0.0-alpha.5-6 to 3.0.0-alpha.5-7
@@ -149,2 +149,5 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator'; | ||
var startTime = Date.now(); | ||
this._logger.debug('[fetch load start], index,', index, ',range,', range); | ||
return fetch(request || url, request ? undefined : init).then( /*#__PURE__*/function () { | ||
@@ -183,3 +186,3 @@ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) { | ||
if (!(responseType === ResponseType.TEXT)) { | ||
_context.next = 14; | ||
_context.next = 15; | ||
break; | ||
@@ -193,22 +196,24 @@ } | ||
data = _context.sent; | ||
_context.next = 30; | ||
_this._running = false; | ||
_context.next = 34; | ||
break; | ||
case 14: | ||
case 15: | ||
if (!(responseType === ResponseType.JSON)) { | ||
_context.next = 20; | ||
_context.next = 22; | ||
break; | ||
} | ||
_context.next = 17; | ||
_context.next = 18; | ||
return response.json(); | ||
case 17: | ||
case 18: | ||
data = _context.sent; | ||
_context.next = 30; | ||
_this._running = false; | ||
_context.next = 34; | ||
break; | ||
case 20: | ||
case 22: | ||
if (!onProgress) { | ||
_context.next = 24; | ||
_context.next = 26; | ||
break; | ||
@@ -219,12 +224,16 @@ } | ||
_context.next = 30; | ||
_context.next = 34; | ||
break; | ||
case 24: | ||
_context.next = 26; | ||
case 26: | ||
_context.next = 28; | ||
return response.arrayBuffer(); | ||
case 26: | ||
case 28: | ||
data = _context.sent; | ||
data = new Uint8Array(data); | ||
_this._running = false; | ||
_this._logger.debug('[fetch load end], index,', index, ',range,', range); | ||
costTime = Date.now() - startTime; | ||
@@ -238,7 +247,6 @@ SpeedSampler.netSampling({ | ||
case 30: | ||
_this._running = false; | ||
case 34: | ||
return _context.abrupt("return", createResponse(data, true, response, response.headers.get('Content-Length'), response.headers.get('age'), startTime, firstByteTime, index, range, _this._vid)); | ||
case 32: | ||
case 35: | ||
case "end": | ||
@@ -400,3 +408,2 @@ return _context.stop(); | ||
_this2._running = data.done; | ||
onProgress(data.value, data.done, { | ||
@@ -410,2 +417,3 @@ range: [startByte, _this2._range[0] + _this2._receivedLength], | ||
costTime = Date.now() - st; | ||
console.log('[fetchLoader SPEED], fetch speed,', _this2._receivedLength * 8 / (costTime / 1000)); | ||
SpeedSampler.netSampling({ | ||
@@ -421,3 +429,5 @@ mTime: costTime, | ||
} else { | ||
_this2._logger.debug('【fetchLoader,onProgress call】,task,', _this2._range, ',done,', data.done); | ||
_this2._running = false; | ||
_this2._logger.debug('[fetchLoader onProgress end],task,', _this2._range, ',done,', data.done); | ||
} | ||
@@ -424,0 +434,0 @@ |
@@ -70,3 +70,2 @@ import _classCallCheck from '@babel/runtime/helpers/classCallCheck'; | ||
var task = new Task(this.type, config); | ||
this.log.debug('[task add queue]', config.range, ', queueLen,', this._queue.length); | ||
@@ -110,4 +109,2 @@ this._queue.push(task); | ||
this.log.debug('[task exec]', this._currentTask._config.range, ', queueLen,', this._queue.length); | ||
this._currentTask.exec().finally(function () { | ||
@@ -114,0 +111,0 @@ _this._processTask(); |
{ | ||
"name": "xgplayer-streaming-shared", | ||
"version": "3.0.0-alpha.5-6", | ||
"version": "3.0.0-alpha.5-7", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
808893
3472