Setting new value for SourceBuffer.timestampOffset may throw errors
Created by: Gontran-Molotov
Environment
- Dash.js version: 2.6.7
- Browser name/version: Chromecast v2
Steps to reproduce
- play a video
- attach a new video while the first one is playing
Observed behaviour
On video switching, the following error may occur:
{"error":"manifestError","event":{"message":"Failed to set the 'timestampOffset' property on 'SourceBuffer': This SourceBuffer is still processing an 'appendBuffer' or 'remove' operation."}
The JavaScript call stack shows that this error occurs when setting a new value for SourceBuffer.timestampOffset
in BufferController.updateBufferTimestampOffset()
.
From this documentation, an InvalidStateError
can be thrown when setting a new value for this property because one or more SourceBuffer objects in MediaSource.sourceBuffers are being updated, a media segment inside the SourceBuffer is currently being parsed, or this SourceBuffer has been removed from the MediaSource.
Dash.js should ensure that no operation is currently performed on the SourceBuffer before setting a new value for timestampOffset.