http-streaming icon indicating copy to clipboard operation
http-streaming copied to clipboard

Error: SourceBuffer has been removed - When changing source

Open iq-dot opened this issue 7 years ago • 7 comments

Description

When a HLS source is loaded and then an Ad video is attempted to play, I get a:

Uncaught DOMException: Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source

When Ads are turned off, the video plays fine. It seems to be an issue where the video source is being changed to the Ad video. I also got the same error with Dash video too.

If you can tell me the best way to cleanly remove a source, it may help. Also I have a VideoJS error handling however that error doesn't get covered, is there another error handling I can add to catch those errors?

Sources

Not necessarily issue with the source

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. Load a video (I use videojs-playlist) with HLS
  2. Then change the source to an Ad video (I use SpotX SDK)
  3. An error is thrown and when you try to play the source video back it sometimes fails.

Results

The error listed in description is thrown.

Expected

Please describe what you expected to happen that did not happen in the description.

Error output

If there are any errors in the console, from the player, or anywhere else please include them here:

Additional Information

If required I can try to create a test page publicly accessible.

videojs-http-streaming version

The one included in VideoJS 7.2

videojs version

what version of videojs does this occur with? video.js 7.2

Browsers

Seems to be mainly Chrome, Safari works but is a bit clunky in the sense it gets stuck but I don't see that exception in the console logs.

Platforms

All

Other Plugins

videojs-playlist videojs-overlay

Other JavaScript

React

iq-dot avatar Sep 13 '18 16:09 iq-dot

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

welcome[bot] avatar Sep 13 '18 16:09 welcome[bot]

I found a solution by using player.reset() before the source is changed.

iq-dot avatar Sep 14 '18 16:09 iq-dot

Hi,

I am having to re-open this issue as the player.reset() although works brings about other issues because it removes the video element from the page and re-creates a new one. Is there a way to do what reset does but not remove the video element?

Changing source from a HLS seems to throw that error.

iq-dot avatar Nov 13 '18 10:11 iq-dot

Hi,

Same thing here, it appends sometimes. It seems to depend on the execution time between Player.src call and SourceUpdater.dispose call. I'm not sure but could it be the sourceBuffer_ of the SourceUpdater that is consumed before calling the SourceUpdater.dispose? Maybe SourceUpdater.dispose should test if the sourceBuffer_ is always in the mediaSource.activeSourceBuffers before trying to abort it?

As a quick and dirty example:

this.mediaSource.activeSourceBuffers.indexOf(this.sourceBuffer_) >= 0

maxime-beguin avatar Nov 30 '18 16:11 maxime-beguin

Does https://github.com/videojs/http-streaming/pull/442 fix this?

mikesherov avatar Apr 11 '19 13:04 mikesherov

Any updates?

ghost avatar Nov 17 '19 07:11 ghost

Still nothing?

Guilherme-Valle avatar Jan 28 '22 19:01 Guilherme-Valle