From 93867af0571b091f9ec9963218baf54dffe71006 Mon Sep 17 00:00:00 2001 From: Tianxiao Wang Date: Wed, 10 Apr 2019 13:23:50 +0800 Subject: [PATCH] fix: remove mseUpdating flag (#63) --- packages/griffith-mp4/src/mse/controller.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/griffith-mp4/src/mse/controller.js b/packages/griffith-mp4/src/mse/controller.js index 7f4f108c..5ca0eb35 100644 --- a/packages/griffith-mp4/src/mse/controller.js +++ b/packages/griffith-mp4/src/mse/controller.js @@ -37,8 +37,6 @@ export default class MSE { this.mimeTypes.audio ) this.sourceBuffers.video.addEventListener('updateend', () => { - this.mseUpdating = false - const buffer = this.videoQueue.shift() if (buffer && this.mediaSource.readyState === 'open') { @@ -143,11 +141,10 @@ export default class MSE { FragmentFetch.clear() const [start, end] = this.mp4Probe.getFragmentPosition(time) - this.mseUpdating = true // 对于已经请求的数据不再重复请求 // No need to repeat request video data - if (this.hasBufferedCache(this.video.currentTime)) { + if (time && this.hasBufferedCache(this.video.currentTime)) { return } @@ -204,7 +201,7 @@ export default class MSE { } = this.mp4Probe if (this.mediaSource.readyState !== 'closed') { - if (offsetInterVal[1] === videoSamplesLength && !this.mseUpdating) { + if (offsetInterVal[1] === videoSamplesLength) { this.destroy() } else if (this.shouldFetchNextSegment()) { this.seek() @@ -221,7 +218,7 @@ export default class MSE { shouldFetchNextSegment = () => { this.handleReplayCase() - if (!this.mseUpdating && this.mp4Probe.isDraining(this.video.currentTime)) { + if (this.mp4Probe.isDraining(this.video.currentTime)) { return true } return false