Skip to content

Commit

Permalink
feat(xgplayer-straming-shared): add op callback
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiangfei authored and gemxx committed May 20, 2024
1 parent 55dad85 commit dde06e2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/xgplayer-streaming-shared/src/mse.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@ export class MSE {
} catch (error) {
if (error && error.message && error.message.indexOf('SourceBuffer is full') >= 0) {
this._mseFullFlag[type] = true
if (op.context && typeof op.context === 'object'){
op.context.isFull = true
}
this._logger.error('[MSE error], context,', op.context, ' ,name,', op.opName, ',err,SourceBuffer is full')
op.promise.reject(new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_FULL, error))
} else {
Expand Down Expand Up @@ -618,6 +621,10 @@ export class MSE {
const costtime = nowTime() - this._opst
this._logger.debug(`UpdateEnd(${type}/${op.opName})`, SafeJSON.stringify(getTimeRanges(this._sourceBuffer[type]?.buffered)), costtime, op.context)
op.promise.resolve({name: op.opName, context: op.context, costtime})
const callback = op.context?.callback
if (callback && typeof callback === 'function'){
callback(op.context)
}
this._startQueue(type)
}
}
Expand Down

0 comments on commit dde06e2

Please sign in to comment.