diff --git a/src/Common/hooks/useMSEplayer.ts b/src/Common/hooks/useMSEplayer.ts index 127fe94b9a0..5271c08fd56 100644 --- a/src/Common/hooks/useMSEplayer.ts +++ b/src/Common/hooks/useMSEplayer.ts @@ -171,9 +171,14 @@ export const useMSEMediaPlayer = ({ } else { mimeCodec = Utf8ArrayToStr(decoded_arr); } - mseSourceBuffer = mse.addSourceBuffer( - `video/mp4; codecs="${mimeCodec}"`, - ); + try { + mseSourceBuffer = mse.addSourceBuffer( + `video/mp4; codecs="${mimeCodec}"`, + ); + } catch (error) { + onError?.(error); + return; + } mseSourceBuffer.mode = "segments"; if (mseQueue.length > 0 && !mseSourceBuffer.updating) { mseSourceBuffer.addEventListener("updateend", pushPacket);