File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1944,7 +1944,20 @@ shaka.media.MediaSourceEngine = class {
1944
1944
* @private
1945
1945
*/
1946
1946
onUpdateEnd_ ( contentType ) {
1947
- if ( this . reloadingMediaSource_ ) {
1947
+ // If we're reloading or have been destroyed, clear the queue for this
1948
+ // content type.
1949
+ if ( this . reloadingMediaSource_ || this . destroyer_ . destroyed ( ) ) {
1950
+ // Resolve any pending operations in this content type's queue
1951
+ const queue = this . queues_ . get ( contentType ) ;
1952
+ if ( queue && queue . length ) {
1953
+ // Resolve the first operation that triggered this updateEnd
1954
+ const firstOperation = queue [ 0 ] ;
1955
+ if ( firstOperation && firstOperation . p ) {
1956
+ firstOperation . p . resolve ( ) ;
1957
+ }
1958
+ // Clear the rest of the queue
1959
+ this . queues_ . set ( contentType , [ ] ) ;
1960
+ }
1948
1961
return ;
1949
1962
}
1950
1963
const operation = this . queues_ . get ( contentType ) [ 0 ] ;
You can’t perform that action at this time.
0 commit comments