Commit 0a2d60b9 by libai

测试

parent 026a1274
......@@ -5,7 +5,7 @@
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.5+7f2b526d
* @version 4.1.0
*/
(function (global, factory) {
......@@ -15,30 +15,27 @@
}(this, (function () { 'use strict';
function objectOrFunction(x) {
var type = typeof x;
return x !== null && (type === 'object' || type === 'function');
return typeof x === 'function' || typeof x === 'object' && x !== null;
}
function isFunction(x) {
return typeof x === 'function';
}
var _isArray = void 0;
if (Array.isArray) {
_isArray = Array.isArray;
} else {
var _isArray = undefined;
if (!Array.isArray) {
_isArray = function (x) {
return Object.prototype.toString.call(x) === '[object Array]';
};
} else {
_isArray = Array.isArray;
}
var isArray = _isArray;
var len = 0;
var vertxNext = void 0;
var customSchedulerFn = void 0;
var vertxNext = undefined;
var customSchedulerFn = undefined;
var asap = function asap(callback, arg) {
queue[len] = callback;
......@@ -67,7 +64,7 @@
var browserWindow = typeof window !== 'undefined' ? window : undefined;
var browserGlobal = browserWindow || {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
// test for web worker but not in IE10
var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
......@@ -138,7 +135,8 @@
function attemptVertx() {
try {
var vertx = Function('return this')().require('vertx');
var r = _dereq_;
var vertx = r('vertx');
vertxNext = vertx.runOnLoop || vertx.runOnContext;
return useVertxTimer();
} catch (e) {
......@@ -146,7 +144,7 @@
}
}
var scheduleFlush = void 0;
var scheduleFlush = undefined;
// Decide what async method to use to triggering processing of queued callbacks:
if (isNode) {
scheduleFlush = useNextTick();
......@@ -161,6 +159,8 @@
}
function then(onFulfillment, onRejection) {
var _arguments = arguments;
var parent = this;
var child = new this.constructor(noop);
......@@ -171,12 +171,13 @@
var _state = parent._state;
if (_state) {
var callback = arguments[_state - 1];
(function () {
var callback = _arguments[_state - 1];
asap(function () {
return invokeCallback(_state, child, callback, parent._result);
});
})();
} else {
subscribe(parent, child, onFulfillment, onRejection);
}
......@@ -215,7 +216,7 @@
@return {Promise} a promise that will become fulfilled with the given
`value`
*/
function resolve$1(object) {
function resolve(object) {
/*jshint validthis:true */
var Constructor = this;
......@@ -224,11 +225,11 @@
}
var promise = new Constructor(noop);
resolve(promise, object);
_resolve(promise, object);
return promise;
}
var PROMISE_ID = Math.random().toString(36).substring(2);
var PROMISE_ID = Math.random().toString(36).substring(16);
function noop() {}
......@@ -236,7 +237,7 @@
var FULFILLED = 1;
var REJECTED = 2;
var TRY_CATCH_ERROR = { error: null };
var GET_THEN_ERROR = new ErrorObject();
function selfFulfillment() {
return new TypeError("You cannot resolve a promise with itself");
......@@ -250,29 +251,29 @@
try {
return promise.then;
} catch (error) {
TRY_CATCH_ERROR.error = error;
return TRY_CATCH_ERROR;
GET_THEN_ERROR.error = error;
return GET_THEN_ERROR;
}
}
function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
try {
then$$1.call(value, fulfillmentHandler, rejectionHandler);
then.call(value, fulfillmentHandler, rejectionHandler);
} catch (e) {
return e;
}
}
function handleForeignThenable(promise, thenable, then$$1) {
function handleForeignThenable(promise, thenable, then) {
asap(function (promise) {
var sealed = false;
var error = tryThen(then$$1, thenable, function (value) {
var error = tryThen(then, thenable, function (value) {
if (sealed) {
return;
}
sealed = true;
if (thenable !== value) {
resolve(promise, value);
_resolve(promise, value);
} else {
fulfill(promise, value);
}
......@@ -282,12 +283,12 @@
}
sealed = true;
reject(promise, reason);
_reject(promise, reason);
}, 'Settle: ' + (promise._label || ' unknown promise'));
if (!sealed && error) {
sealed = true;
reject(promise, error);
_reject(promise, error);
}
}, promise);
}
......@@ -296,36 +297,36 @@
if (thenable._state === FULFILLED) {
fulfill(promise, thenable._result);
} else if (thenable._state === REJECTED) {
reject(promise, thenable._result);
_reject(promise, thenable._result);
} else {
subscribe(thenable, undefined, function (value) {
return resolve(promise, value);
return _resolve(promise, value);
}, function (reason) {
return reject(promise, reason);
return _reject(promise, reason);
});
}
}
function handleMaybeThenable(promise, maybeThenable, then$$1) {
if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
function handleMaybeThenable(promise, maybeThenable, then$$) {
if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
handleOwnThenable(promise, maybeThenable);
} else {
if (then$$1 === TRY_CATCH_ERROR) {
reject(promise, TRY_CATCH_ERROR.error);
TRY_CATCH_ERROR.error = null;
} else if (then$$1 === undefined) {
if (then$$ === GET_THEN_ERROR) {
_reject(promise, GET_THEN_ERROR.error);
GET_THEN_ERROR.error = null;
} else if (then$$ === undefined) {
fulfill(promise, maybeThenable);
} else if (isFunction(then$$1)) {
handleForeignThenable(promise, maybeThenable, then$$1);
} else if (isFunction(then$$)) {
handleForeignThenable(promise, maybeThenable, then$$);
} else {
fulfill(promise, maybeThenable);
}
}
}
function resolve(promise, value) {
function _resolve(promise, value) {
if (promise === value) {
reject(promise, selfFulfillment());
_reject(promise, selfFulfillment());
} else if (objectOrFunction(value)) {
handleMaybeThenable(promise, value, getThen(value));
} else {
......@@ -354,7 +355,7 @@
}
}
function reject(promise, reason) {
function _reject(promise, reason) {
if (promise._state !== PENDING) {
return;
}
......@@ -368,7 +369,6 @@
var _subscribers = parent._subscribers;
var length = _subscribers.length;
parent._onerror = null;
_subscribers[length] = child;
......@@ -388,8 +388,8 @@
return;
}
var child = void 0,
callback = void 0,
var child = undefined,
callback = undefined,
detail = promise._result;
for (var i = 0; i < subscribers.length; i += 3) {
......@@ -406,6 +406,12 @@
promise._subscribers.length = 0;
}
function ErrorObject() {
this.error = null;
}
var TRY_CATCH_ERROR = new ErrorObject();
function tryCatch(callback, detail) {
try {
return callback(detail);
......@@ -417,10 +423,10 @@
function invokeCallback(settled, promise, callback, detail) {
var hasCallback = isFunction(callback),
value = void 0,
error = void 0,
succeeded = void 0,
failed = void 0;
value = undefined,
error = undefined,
succeeded = undefined,
failed = undefined;
if (hasCallback) {
value = tryCatch(callback, detail);
......@@ -434,7 +440,7 @@
}
if (promise === value) {
reject(promise, cannotReturnOwn());
_reject(promise, cannotReturnOwn());
return;
}
} else {
......@@ -445,25 +451,25 @@
if (promise._state !== PENDING) {
// noop
} else if (hasCallback && succeeded) {
resolve(promise, value);
_resolve(promise, value);
} else if (failed) {
reject(promise, error);
_reject(promise, error);
} else if (settled === FULFILLED) {
fulfill(promise, value);
} else if (settled === REJECTED) {
reject(promise, value);
_reject(promise, value);
}
}
function initializePromise(promise, resolver) {
try {
resolver(function resolvePromise(value) {
resolve(promise, value);
_resolve(promise, value);
}, function rejectPromise(reason) {
reject(promise, reason);
_reject(promise, reason);
});
} catch (e) {
reject(promise, e);
_reject(promise, e);
}
}
......@@ -479,11 +485,6 @@
promise._subscribers = [];
}
function validationError() {
return new Error('Array Methods must be provided an Array');
}
var Enumerator = function () {
function Enumerator(Constructor, input) {
this._instanceConstructor = Constructor;
this.promise = new Constructor(noop);
......@@ -493,6 +494,7 @@
}
if (isArray(input)) {
this._input = input;
this.length = input.length;
this._remaining = input.length;
......@@ -502,28 +504,34 @@
fulfill(this.promise, this._result);
} else {
this.length = this.length || 0;
this._enumerate(input);
this._enumerate();
if (this._remaining === 0) {
fulfill(this.promise, this._result);
}
}
} else {
reject(this.promise, validationError());
_reject(this.promise, validationError());
}
}
Enumerator.prototype._enumerate = function _enumerate(input) {
for (var i = 0; this._state === PENDING && i < input.length; i++) {
this._eachEntry(input[i], i);
function validationError() {
return new Error('Array Methods must be provided an Array');
};
Enumerator.prototype._enumerate = function () {
var length = this.length;
var _input = this._input;
for (var i = 0; this._state === PENDING && i < length; i++) {
this._eachEntry(_input[i], i);
}
};
Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
Enumerator.prototype._eachEntry = function (entry, i) {
var c = this._instanceConstructor;
var resolve$$1 = c.resolve;
var resolve$$ = c.resolve;
if (resolve$$1 === resolve$1) {
if (resolve$$ === resolve) {
var _then = getThen(entry);
if (_then === then && entry._state !== PENDING) {
......@@ -531,29 +539,28 @@
} else if (typeof _then !== 'function') {
this._remaining--;
this._result[i] = entry;
} else if (c === Promise$1) {
} else if (c === Promise) {
var promise = new c(noop);
handleMaybeThenable(promise, entry, _then);
this._willSettleAt(promise, i);
} else {
this._willSettleAt(new c(function (resolve$$1) {
return resolve$$1(entry);
this._willSettleAt(new c(function (resolve$$) {
return resolve$$(entry);
}), i);
}
} else {
this._willSettleAt(resolve$$1(entry), i);
this._willSettleAt(resolve$$(entry), i);
}
};
Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
Enumerator.prototype._settledAt = function (state, i, value) {
var promise = this.promise;
if (promise._state === PENDING) {
this._remaining--;
if (state === REJECTED) {
reject(promise, value);
_reject(promise, value);
} else {
this._result[i] = value;
}
......@@ -564,7 +571,7 @@
}
};
Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
Enumerator.prototype._willSettleAt = function (promise, i) {
var enumerator = this;
subscribe(promise, undefined, function (value) {
......@@ -574,9 +581,6 @@
});
};
return Enumerator;
}();
/**
`Promise.all` accepts an array of promises, and returns a new promise which
is fulfilled with an array of fulfillment values for the passed promises, or
......@@ -745,11 +749,11 @@
Useful for tooling.
@return {Promise} a promise rejected with the given `reason`.
*/
function reject$1(reason) {
function reject(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(noop);
reject(promise, reason);
_reject(promise, reason);
return promise;
}
......@@ -860,12 +864,10 @@
```
@class Promise
@param {Function} resolver
@param {function} resolver
Useful for tooling.
@constructor
*/
var Promise$1 = function () {
function Promise(resolver) {
this[PROMISE_ID] = nextId();
this._result = this._state = undefined;
......@@ -877,10 +879,22 @@
}
}
Promise.all = all;
Promise.race = race;
Promise.resolve = resolve;
Promise.reject = reject;
Promise._setScheduler = setScheduler;
Promise._setAsap = setAsap;
Promise._asap = asap;
Promise.prototype = {
constructor: Promise,
/**
The primary way of interacting with a promise is through its `then` method,
which registers callbacks to receive either a promise's eventual value or the
reason why the promise cannot be fulfilled.
```js
findUser().then(function(user){
// user is available
......@@ -888,11 +902,14 @@
// user is unavailable, and you are given the reason why
});
```
Chaining
--------
The return value of `then` is itself a promise. This second, 'downstream'
promise is resolved with the return value of the first promise's fulfillment
or rejection handler, or rejected if the handler throws an exception.
```js
findUser().then(function (user) {
return user.name;
......@@ -902,6 +919,7 @@
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
});
findUser().then(function (user) {
throw new Error('Found user, but still unhappy');
}, function (reason) {
......@@ -914,6 +932,7 @@
});
```
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
```js
findUser().then(function (user) {
throw new PedagogicalException('Upstream error');
......@@ -925,12 +944,15 @@
// The `PedgagocialException` is propagated all the way down to here
});
```
Assimilation
------------
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously. This can be achieved by returning a promise in the
fulfillment or rejection handler. The downstream promise will then be pending
until the returned promise is settled. This is called *assimilation*.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
......@@ -938,7 +960,9 @@
// The user's comments are now available
});
```
If the assimliated promise rejects, then the downstream promise will also reject.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
......@@ -948,11 +972,15 @@
// If `findCommentsByAuthor` rejects, we'll have the reason here
});
```
Simple Example
--------------
Synchronous Example
```javascript
let result;
try {
result = findResult();
// success
......@@ -960,7 +988,9 @@
// failure
}
```
Errback Example
```js
findResult(function(result, err){
if (err) {
......@@ -970,7 +1000,9 @@
}
});
```
Promise Example;
```javascript
findResult().then(function(result){
// success
......@@ -978,11 +1010,15 @@
// failure
});
```
Advanced Example
--------------
Synchronous Example
```javascript
let author, books;
try {
author = findAuthor();
books = findBooksByAuthor(author);
......@@ -991,12 +1027,19 @@
// failure
}
```
Errback Example
```js
function foundBooks(books) {
}
function failure(reason) {
}
findAuthor(function(author, err){
if (err) {
failure(err);
......@@ -1021,7 +1064,9 @@
}
});
```
Promise Example;
```javascript
findAuthor().
then(findBooksByAuthor).
......@@ -1031,116 +1076,49 @@
// something went wrong
});
```
@method then
@param {Function} onFulfilled
@param {Function} onRejected
Useful for tooling.
@return {Promise}
*/
then: then,
/**
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
as the catch block of a try/catch statement.
```js
function findAuthor(){
throw new Error('couldn't find that author');
}
// synchronous
try {
findAuthor();
} catch(reason) {
// something went wrong
}
// async with promises
findAuthor().catch(function(reason){
// something went wrong
});
```
@method catch
@param {Function} onRejection
Useful for tooling.
@return {Promise}
*/
Promise.prototype.catch = function _catch(onRejection) {
'catch': function _catch(onRejection) {
return this.then(null, onRejection);
};
/**
`finally` will be invoked regardless of the promise's fate just as native
try/catch/finally behaves
Synchronous example:
```js
findAuthor() {
if (Math.random() > 0.5) {
throw new Error();
}
return new Author();
}
try {
return findAuthor(); // succeed or fail
} catch(error) {
return findOtherAuther();
} finally {
// always runs
// doesn't affect the return value
}
```
Asynchronous example:
```js
findAuthor().catch(function(reason){
return findOtherAuther();
}).finally(function(){
// author was either found, or not
});
```
@method finally
@param {Function} callback
@return {Promise}
*/
Promise.prototype.finally = function _finally(callback) {
var promise = this;
var constructor = promise.constructor;
if (isFunction(callback)) {
return promise.then(function (value) {
return constructor.resolve(callback()).then(function () {
return value;
});
}, function (reason) {
return constructor.resolve(callback()).then(function () {
throw reason;
});
});
}
return promise.then(callback, callback);
};
return Promise;
}();
Promise$1.prototype.then = then;
Promise$1.all = all;
Promise$1.race = race;
Promise$1.resolve = resolve$1;
Promise$1.reject = reject$1;
Promise$1._setScheduler = setScheduler;
Promise$1._setAsap = setAsap;
Promise$1._asap = asap;
/*global self*/
function polyfill() {
var local = void 0;
var local = undefined;
if (typeof global !== 'undefined') {
local = global;
......@@ -1169,21 +1147,18 @@
}
}
local.Promise = Promise$1;
local.Promise = Promise;
}
// Strange compat..
Promise$1.polyfill = polyfill;
Promise$1.Promise = Promise$1;
Promise.polyfill = polyfill;
Promise.Promise = Promise;
return Promise$1;
return Promise;
})));
}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"_process":3}],2:[function(_dereq_,module,exports){
......@@ -1708,7 +1683,7 @@
wcache[key] = key;
}
sources[wkey] = [
'function(require,module,exports){' + fn + '(self); }',
Function(['require','module','exports'], '(' + fn + ')(self)'),
wcache
];
}
......@@ -1716,11 +1691,12 @@
var scache = {}; scache[wkey] = wkey;
sources[skey] = [
'function(require,module,exports){' +
// try to call default if defined to also support babel esmodule exports
Function(['require'], (
// try to call default if defined to also support babel esmodule
// exports
'var f = require(' + stringify(wkey) + ');' +
'(f.default ? f.default : f)(self);' +
'}',
'(f.default ? f.default : f)(self);'
)),
scache
];
......@@ -1809,11 +1785,8 @@
seekParamEnd: 'bend',
rangeLoadZeroStart: false,
customSeekHandler: undefined,
reuseRedirectedURL: false,
reuseRedirectedURL: false
// referrerPolicy: leave as unspecified
headers: undefined,
customLoader: undefined
};
function createDefaultConfig() {
......@@ -2477,12 +2450,7 @@
var sb = this._sourceBuffers[type];
if (sb) {
if (ms.readyState !== 'closed') {
// ms edge can throw an error: Unexpected call to method or property access
try {
ms.removeSourceBuffer(sb);
} catch (error) {
_logger2.default.e(this.TAG, error.message);
}
sb.removeEventListener('error', this.e.onSourceBufferError);
sb.removeEventListener('updateend', this.e.onSourceBufferUpdateEnd);
}
......@@ -3041,8 +3009,6 @@
ctl.on(_transmuxingEvents2.default.LOADING_COMPLETE, this._onLoadingComplete.bind(this));
ctl.on(_transmuxingEvents2.default.RECOVERED_EARLY_EOF, this._onRecoveredEarlyEof.bind(this));
ctl.on(_transmuxingEvents2.default.MEDIA_INFO, this._onMediaInfo.bind(this));
ctl.on(_transmuxingEvents2.default.METADATA_ARRIVED, this._onMetaDataArrived.bind(this));
ctl.on(_transmuxingEvents2.default.SCRIPTDATA_ARRIVED, this._onScriptDataArrived.bind(this));
ctl.on(_transmuxingEvents2.default.STATISTICS_INFO, this._onStatisticsInfo.bind(this));
ctl.on(_transmuxingEvents2.default.RECOMMEND_SEEKPOINT, this._onRecommendSeekpoint.bind(this));
}
......@@ -3172,57 +3138,39 @@
});
}
}, {
key: '_onMetaDataArrived',
value: function _onMetaDataArrived(metadata) {
var _this6 = this;
Promise.resolve().then(function () {
_this6._emitter.emit(_transmuxingEvents2.default.METADATA_ARRIVED, metadata);
});
}
}, {
key: '_onScriptDataArrived',
value: function _onScriptDataArrived(data) {
var _this7 = this;
Promise.resolve().then(function () {
_this7._emitter.emit(_transmuxingEvents2.default.SCRIPTDATA_ARRIVED, data);
});
}
}, {
key: '_onStatisticsInfo',
value: function _onStatisticsInfo(statisticsInfo) {
var _this8 = this;
var _this6 = this;
Promise.resolve().then(function () {
_this8._emitter.emit(_transmuxingEvents2.default.STATISTICS_INFO, statisticsInfo);
_this6._emitter.emit(_transmuxingEvents2.default.STATISTICS_INFO, statisticsInfo);
});
}
}, {
key: '_onIOError',
value: function _onIOError(type, info) {
var _this9 = this;
var _this7 = this;
Promise.resolve().then(function () {
_this9._emitter.emit(_transmuxingEvents2.default.IO_ERROR, type, info);
_this7._emitter.emit(_transmuxingEvents2.default.IO_ERROR, type, info);
});
}
}, {
key: '_onDemuxError',
value: function _onDemuxError(type, info) {
var _this10 = this;
var _this8 = this;
Promise.resolve().then(function () {
_this10._emitter.emit(_transmuxingEvents2.default.DEMUX_ERROR, type, info);
_this8._emitter.emit(_transmuxingEvents2.default.DEMUX_ERROR, type, info);
});
}
}, {
key: '_onRecommendSeekpoint',
value: function _onRecommendSeekpoint(milliseconds) {
var _this11 = this;
var _this9 = this;
Promise.resolve().then(function () {
_this11._emitter.emit(_transmuxingEvents2.default.RECOMMEND_SEEKPOINT, milliseconds);
_this9._emitter.emit(_transmuxingEvents2.default.RECOMMEND_SEEKPOINT, milliseconds);
});
}
}, {
......@@ -3258,8 +3206,6 @@
Object.setPrototypeOf(data, _mediaInfo2.default.prototype);
this._emitter.emit(message.msg, data);
break;
case _transmuxingEvents2.default.METADATA_ARRIVED:
case _transmuxingEvents2.default.SCRIPTDATA_ARRIVED:
case _transmuxingEvents2.default.STATISTICS_INFO:
this._emitter.emit(message.msg, data);
break;
......@@ -3606,8 +3552,6 @@
this._demuxer.onError = this._onDemuxException.bind(this);
this._demuxer.onMediaInfo = this._onMediaInfo.bind(this);
this._demuxer.onMetaDataArrived = this._onMetaDataArrived.bind(this);
this._demuxer.onScriptDataArrived = this._onScriptDataArrived.bind(this);
this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl));
......@@ -3658,16 +3602,6 @@
}
}
}, {
key: '_onMetaDataArrived',
value: function _onMetaDataArrived(metadata) {
this._emitter.emit(_transmuxingEvents2.default.METADATA_ARRIVED, metadata);
}
}, {
key: '_onScriptDataArrived',
value: function _onScriptDataArrived(data) {
this._emitter.emit(_transmuxingEvents2.default.SCRIPTDATA_ARRIVED, data);
}
}, {
key: '_onIOSeeked',
value: function _onIOSeeked() {
this._remuxer.insertDiscontinuity();
......@@ -3680,7 +3614,6 @@
if (nextSegmentIndex < this._mediaDataSource.segments.length) {
this._internalAbort();
this._remuxer.flushStashedSamples();
this._loadSegment(nextSegmentIndex);
} else {
this._remuxer.flushStashedSamples();
......@@ -3826,8 +3759,6 @@
LOADING_COMPLETE: 'loading_complete',
RECOVERED_EARLY_EOF: 'recovered_early_eof',
MEDIA_INFO: 'media_info',
METADATA_ARRIVED: 'metadata_arrived',
SCRIPTDATA_ARRIVED: 'scriptdata_arrived',
STATISTICS_INFO: 'statistics_info',
RECOMMEND_SEEKPOINT: 'recommend_seekpoint'
};
......@@ -3895,8 +3826,6 @@
controller.on(_transmuxingEvents2.default.LOADING_COMPLETE, onLoadingComplete.bind(this));
controller.on(_transmuxingEvents2.default.RECOVERED_EARLY_EOF, onRecoveredEarlyEof.bind(this));
controller.on(_transmuxingEvents2.default.MEDIA_INFO, onMediaInfo.bind(this));
controller.on(_transmuxingEvents2.default.METADATA_ARRIVED, onMetaDataArrived.bind(this));
controller.on(_transmuxingEvents2.default.SCRIPTDATA_ARRIVED, onScriptDataArrived.bind(this));
controller.on(_transmuxingEvents2.default.STATISTICS_INFO, onStatisticsInfo.bind(this));
controller.on(_transmuxingEvents2.default.RECOMMEND_SEEKPOINT, onRecommendSeekpoint.bind(this));
break;
......@@ -3981,22 +3910,6 @@
self.postMessage(obj);
}
function onMetaDataArrived(metadata) {
var obj = {
msg: _transmuxingEvents2.default.METADATA_ARRIVED,
data: metadata
};
self.postMessage(obj);
}
function onScriptDataArrived(data) {
var obj = {
msg: _transmuxingEvents2.default.SCRIPTDATA_ARRIVED,
data: data
};
self.postMessage(obj);
}
function onStatisticsInfo(statInfo) {
var obj = {
msg: _transmuxingEvents2.default.STATISTICS_INFO,
......@@ -4597,8 +4510,6 @@
this._onError = null;
this._onMediaInfo = null;
this._onMetaDataArrived = null;
this._onScriptDataArrived = null;
this._onTrackMetadata = null;
this._onDataAvailable = null;
......@@ -4668,8 +4579,6 @@
this._onError = null;
this._onMediaInfo = null;
this._onMetaDataArrived = null;
this._onScriptDataArrived = null;
this._onTrackMetadata = null;
this._onDataAvailable = null;
}
......@@ -4829,10 +4738,6 @@
this._metadata = scriptData;
var onMetaData = this._metadata.onMetaData;
if (this._onMetaDataArrived) {
this._onMetaDataArrived(Object.assign({}, onMetaData));
}
if (typeof onMetaData.hasAudio === 'boolean') {
// hasAudio
if (this._hasAudioFlagOverrided === false) {
......@@ -4901,12 +4806,6 @@
this._onMediaInfo(this._mediaInfo);
}
}
if (Object.keys(scriptData).length > 0) {
if (this._onScriptDataArrived) {
this._onScriptDataArrived(Object.assign({}, scriptData));
}
}
}
}, {
key: '_parseKeyframesIndex',
......@@ -5598,22 +5497,6 @@
set: function set(callback) {
this._onMediaInfo = callback;
}
}, {
key: 'onMetaDataArrived',
get: function get() {
return this._onMetaDataArrived;
},
set: function set(callback) {
this._onMetaDataArrived = callback;
}
}, {
key: 'onScriptDataArrived',
get: function get() {
return this._onScriptDataArrived;
},
set: function set(callback) {
this._onScriptDataArrived = callback;
}
// prototype: function(type: number, info: string): void
......@@ -6065,8 +5948,6 @@
var _features2 = _interopRequireDefault(_features);
var _loader = _dereq_('./io/loader.js');
var _flvPlayer = _dereq_('./player/flv-player.js');
var _flvPlayer2 = _interopRequireDefault(_flvPlayer);
......@@ -6129,10 +6010,6 @@
flvjs.isSupported = isSupported;
flvjs.getFeatureList = getFeatureList;
flvjs.BaseLoader = _loader.BaseLoader;
flvjs.LoaderStatus = _loader.LoaderStatus;
flvjs.LoaderErrors = _loader.LoaderErrors;
flvjs.Events = _playerEvents2.default;
flvjs.ErrorTypes = _playerErrors.ErrorTypes;
flvjs.ErrorDetails = _playerErrors.ErrorDetails;
......@@ -6145,13 +6022,13 @@
enumerable: true,
get: function get() {
// replaced by browserify-versionify transform
return '1.5.0';
return '1.4.0';
}
});
exports.default = flvjs;
},{"./core/features.js":6,"./io/loader.js":24,"./player/flv-player.js":32,"./player/native-player.js":33,"./player/player-errors.js":34,"./player/player-events.js":35,"./utils/exception.js":40,"./utils/logging-control.js":42,"./utils/polyfill.js":43}],21:[function(_dereq_,module,exports){
},{"./core/features.js":6,"./player/flv-player.js":32,"./player/native-player.js":33,"./player/player-errors.js":34,"./player/player-events.js":35,"./utils/exception.js":40,"./utils/logging-control.js":42,"./utils/polyfill.js":43}],21:[function(_dereq_,module,exports){
'use strict';
// entry/index file
......@@ -6294,13 +6171,6 @@
referrerPolicy: 'no-referrer-when-downgrade'
};
// add additional headers
if (_typeof(this._config.headers) === 'object') {
for (var _key in this._config.headers) {
headers.append(_key, this._config.headers[_key]);
}
}
// cors is enabled by default
if (dataSource.cors === false) {
// no-cors means 'disregard cors policy', which can only be used in ServiceWorker
......@@ -6373,24 +6243,10 @@
// ReadableStreamReader
return reader.read().then(function (result) {
if (result.done) {
// First check received length
if (_this3._contentLength !== null && _this3._receivedLength < _this3._contentLength) {
// Report Early-EOF
_this3._status = _loader.LoaderStatus.kError;
var type = _loader.LoaderErrors.EARLY_EOF;
var info = { code: -1, msg: 'Fetch stream meet Early-EOF' };
if (_this3._onError) {
_this3._onError(type, info);
} else {
throw new _exception.RuntimeException(info.msg);
}
} else {
// OK. Download complete
_this3._status = _loader.LoaderStatus.kComplete;
if (_this3._onComplete) {
_this3._onComplete(_this3._range.from, _this3._range.from + _this3._receivedLength - 1);
}
}
} else {
if (_this3._requestAbort === true) {
_this3._requestAbort = false;
......@@ -6644,9 +6500,7 @@
}, {
key: '_selectLoader',
value: function _selectLoader() {
if (this._config.customLoader != null) {
this._loaderClass = this._config.customLoader;
} else if (this._isWebSocketURL) {
if (this._isWebSocketURL) {
this._loaderClass = _websocketLoader2.default;
} else if (_fetchStreamLoader2.default.isSupported()) {
this._loaderClass = _fetchStreamLoader2.default;
......@@ -7963,17 +7817,6 @@
}
}
// add additional headers
if (_typeof(this._config.headers) === 'object') {
var _headers = this._config.headers;
for (var _key in _headers) {
if (_headers.hasOwnProperty(_key)) {
xhr.setRequestHeader(_key, _headers[_key]);
}
}
}
this._status = _loader.LoaderStatus.kConnecting;
xhr.send();
}
......@@ -8258,17 +8101,6 @@
}
}
// add additional headers
if (_typeof(this._config.headers) === 'object') {
var _headers = this._config.headers;
for (var _key in _headers) {
if (_headers.hasOwnProperty(_key)) {
xhr.setRequestHeader(_key, _headers[_key]);
}
}
}
if (this._isReconnecting) {
this._isReconnecting = false;
} else {
......@@ -8633,17 +8465,6 @@
}
}
// add additional headers
if (_typeof(this._config.headers) === 'object') {
var _headers = this._config.headers;
for (var _key in _headers) {
if (_headers.hasOwnProperty(_key)) {
xhr.setRequestHeader(_key, _headers[_key]);
}
}
}
xhr.send();
}
}, {
......@@ -9146,12 +8967,6 @@
_this3._mediaInfo = mediaInfo;
_this3._emitter.emit(_playerEvents2.default.MEDIA_INFO, Object.assign({}, mediaInfo));
});
this._transmuxer.on(_transmuxingEvents2.default.METADATA_ARRIVED, function (metadata) {
_this3._emitter.emit(_playerEvents2.default.METADATA_ARRIVED, metadata);
});
this._transmuxer.on(_transmuxingEvents2.default.SCRIPTDATA_ARRIVED, function (data) {
_this3._emitter.emit(_playerEvents2.default.SCRIPTDATA_ARRIVED, data);
});
this._transmuxer.on(_transmuxingEvents2.default.STATISTICS_INFO, function (statInfo) {
_this3._statisticsInfo = _this3._fillStatisticsInfo(statInfo);
_this3._emitter.emit(_playerEvents2.default.STATISTICS_INFO, Object.assign({}, _this3._statisticsInfo));
......@@ -9921,8 +9736,6 @@
LOADING_COMPLETE: 'loading_complete',
RECOVERED_EARLY_EOF: 'recovered_early_eof',
MEDIA_INFO: 'media_info',
METADATA_ARRIVED: 'metadata_arrived',
SCRIPTDATA_ARRIVED: 'scriptdata_arrived',
STATISTICS_INFO: 'statistics_info'
};
......@@ -10956,7 +10769,7 @@
}
};
silentFrames.push(frame);
mdatBytes += frame.size;
mdatBytes += unit.byteLength;
currentDts += refSampleDuration;
}
......@@ -11591,7 +11404,7 @@
} else if (console.warn) {
console.warn(str);
} else {
//console.log(str);
console.log(str);
}
}
}, {
......@@ -11612,7 +11425,7 @@
if (console.info) {
console.info(str);
} else {
//console.log(str);
console.log(str);
}
}
}, {
......@@ -11633,7 +11446,7 @@
if (console.warn) {
console.warn(str);
} else {
//console.log(str);
console.log(str);
}
}
}, {
......@@ -11654,7 +11467,7 @@
if (console.debug) {
console.debug(str);
} else {
//console.log(str);
console.log(str);
}
}
}, {
......@@ -11672,7 +11485,7 @@
return;
}
//console.log(str);
console.log(str);
}
}]);
......
......@@ -480,7 +480,8 @@ $(function () {
var sendType=1;
var guardShowOk=null;
var richType=1
var layzT=true;
var layzT=true;3
$(window).on("scroll",function(){
if(layzT==true){
layzT=false
......@@ -622,6 +623,8 @@ $(function () {
if (promise !== undefined) {
promise.then(_ => {
var html = [];
html += '<div class="live-video jswebrtc" data-url="'+data.pullFlowUrl+'" ></div>';
$(".live-content-box-left-roombox").html(html)
html += '<video controls webkit-playsinline ="true" playsinline ="true" autoplay ="" playsinline="true" class="live-video" src="" id="videoElement" loop="" ></video>';
$(".live-content-box-left-roombox").html(html)
flvPlay(data.pullFlowUrl)
......
......@@ -226,10 +226,10 @@ $(function(){
}
$(".video-tag-box").html(html);
var html=[];
html+='<video autoplay="" class="video" src="" id="videoElement" controls="" loop="" poster="https://zhibocdn.yabolive.net/comm'+videoList.videos[0].cover+'"></video>';
html+='<video autoplay="" class="video" src="https://zhibocdn.yabolive.net/comm'+videoList.videos[0].url.replace("flv","mp4")+'" id="videoElement" controls="" loop="" poster="https://zhibocdn.yabolive.net/comm'+videoList.videos[0].cover+'"></video>';
$(".video-play-box").html(html)
var flvUrl=videoList.videos[0].url.replace("mp4","flv")
flvPlay('https://zhibocdn.yabolive.net/comm'+flvUrl+'')
// var flvUrl=videoList.videos[0].url.replace("mp4","flv")
// flvPlay('https://zhibocdn.yabolive.net/comm'+flvUrl+'')
if(data.selfUp==1) var html='<div><img src="images/icon1.png" alt=""><span>'+data.comment+'</span></div><div class="good-box"><img class="good-btn" data-type="1" src="images/icon2-click.png" alt=""><span>'+data.up+'</span></div>';
else var html='<div><img src="images/icon1.png" alt=""><span>'+data.comment+'</span></div><div class="good-box"><img class="good-btn" data-type="0" src="images/icon2.png" alt=""><span>'+data.up+'</span></div>';
$(".video-btn-box").html(html)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment