File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -298,9 +298,11 @@ function SourceBufferSink(config) {
298298 const appendWindowStart = buffer . appendWindowStart ;
299299 const appendWindowEnd = buffer . appendWindowEnd ;
300300
301- buffer . abort ( ) ;
302- buffer . appendWindowStart = appendWindowStart ;
303- buffer . appendWindowEnd = appendWindowEnd ;
301+ if ( buffer ) {
302+ buffer . abort ( ) ;
303+ buffer . appendWindowStart = appendWindowStart ;
304+ buffer . appendWindowEnd = appendWindowEnd ;
305+ }
304306 resolve ( ) ;
305307 } ) ;
306308 } ) ;
@@ -401,7 +403,9 @@ function SourceBufferSink(config) {
401403 appendQueue = [ ] ;
402404 if ( mediaSource . readyState === 'open' ) {
403405 _waitForUpdateEnd ( ( ) => {
404- buffer . abort ( ) ;
406+ if ( buffer ) {
407+ buffer . abort ( ) ;
408+ }
405409 resolve ( ) ;
406410 } ) ;
407411 } else if ( buffer && buffer . setTextTrack && mediaSource . readyState === 'ended' ) {
Original file line number Diff line number Diff line change @@ -284,12 +284,15 @@ function BufferController(config) {
284284 return ;
285285 }
286286
287+ // Check if session has not been stopped in the meantime (while last segment was being appended)
288+ if ( ! sourceBufferSink ) return ;
289+
287290 _updateBufferLevel ( ) ;
288291
289292 isQuotaExceeded = false ;
290293 appendedBytesInfo = e . chunk ;
291294
292- if ( ! appendedBytesInfo . endFragment ) {
295+ if ( ! appendedBytesInfo || ! appendedBytesInfo . endFragment ) {
293296 return ;
294297 }
295298
You can’t perform that action at this time.
0 commit comments