Setting .timestampOffset of MediaSource.SourceBuffer within updateend event handler throws error
Reported by
guest271...@gmail.com,
Sep 17 2017
|
|||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/60.0.3112.113 Chrome/60.0.3112.113 Safari/537.36
Steps to reproduce the problem:
1. Set .timestampOffset of multiple tracks within updateend event
2.
3.
What is the expected behavior?
timestampOffset to be set
What went wrong?
Uncaught (in promise) DOMException: Failed to set the 'timestampOffset' property on 'SourceBuffer': The timestamp offset may not be set while the SourceBuffer's append state is 'PARSING_MEDIA_SEGMENT'.
at SourceBuffer.sourceBuffer.onupdateend
Did this work before? N/A
Does this work in other browsers? Yes
Chrome version: 60.0.3112.113 Channel: n/a
OS Version:
Flash Version:
Related https://bugzilla.mozilla.org/show_bug.cgi?id=1400587
,
Sep 18 2017
Assigning to wolenetz@ from Issue 737757 for more inputs and further triaging of this.
,
Sep 18 2017
This is very likely per spec. Without a specific repro to investigate, I cannot tell more certainly. MSE spec text (within https://www.w3.org/TR/media-source/#dom-sourcebuffer-timestampoffset): "If the append state equals PARSING_MEDIA_SEGMENT, then throw an InvalidStateError and abort these steps." Specifically, even though the user agent has signalled 'updateend', it doesn't mean that the JS app ended that previous appendBuffer with bytes corresponding to the completion of the media segment. What kind of bytestream are you using? Is the app unable to determine the media segment boundary for that bytestream and adjust how it appends media and when it signals timestampOffset accordingly? Note, if you need (though this may drop partially parsed but not yet fully buffered media in not-necessarily-interoperable ways across MSE implementations) to reset the parser state, there is the SourceBuffer.abort() operation which may assist your use case. Note that a future appendBuffer() following such an abort() on the SourceBuffer will require you begin at a segment (init or media) boundary for the bytestream. Closing this as WAI. Please re-open if this diagnosis is incorrect (along with specific repro steps please). |
|||
►
Sign in to add a comment |
|||
Comment 1 by guest271...@gmail.com
, Sep 17 2017Workaround using try..catch try { sourceBuffer.timestampOffset += sourceBuffer.buffered.end(0); resolveUpdatedMediaSource(); } catch (err) { console.error(err); resolveUpdatedMediaSource(); } https://github.com/guest271314/recordMediaFragments/commit/da902dc083de8229f335cb057bea90407c5f30a7