Files
shaka-player/lib
Julian Domingo 6610fa3e57 fix: re-open the MediaSource if readyState is not open when the init() method is called. (#7783)
Builds on top of @tykus160's observation in
https://github.com/shaka-project/shaka-player/issues/4903 where
`MediaSource.readyState` was either in a `closed` or `ended` state when
the `MediaSourceEngine.init()` logic is executed.

This fix will simply re-open the `MediaSource` if non-open, resulting in
fewer scenarios where the `MEDIA_SOURCE_OPERATION_THREW` error:
https://github.com/shaka-project/shaka-player/blob/de0f33c2623b057e80b7cafd53e19fac2f984961/lib/media/media_source_engine.js#L648-L651

is thrown because of an
[`InvalidStateError`](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/addSourceBuffer#exceptions).
2024-12-19 18:37:01 -08:00
..