Skip to content

Commit

Permalink
Fix IE11 smooth switch stuck in PARSING state
Browse files Browse the repository at this point in the history
Fix demo Timeline media buffers in IE11
  • Loading branch information
Rob Walch committed Apr 1, 2021
1 parent d4c5ffc commit 22d983a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions demo/chart/timeline-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export class TimelineChart {
sourceBuffer,
})
);
sourceBuffer.onupdate = () => {
sourceBuffer.addEventListener('update', () => {
try {
replaceTimeRangeTuples(sourceBuffer.buffered, data);
} catch (error) {
Expand All @@ -445,7 +445,7 @@ export class TimelineChart {
}
replaceTimeRangeTuples(media.buffered, mediaBufferData);
this.update();
};
});
});

if (trackTypes.length === 0) {
Expand Down
6 changes: 4 additions & 2 deletions src/controller/base-stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,12 @@ export default class BaseStreamController
return;
}
this.fragLoadError = 0;
const state = this.state;
if (this.fragContextChanged(frag)) {
if (
this.state === State.FRAG_LOADING ||
this.state === State.BACKTRACKING
state === State.FRAG_LOADING ||
state === State.BACKTRACKING ||
(!this.fragCurrent && state === State.PARSING)
) {
this.fragmentTracker.removeFragment(frag);
this.state = State.IDLE;
Expand Down
2 changes: 1 addition & 1 deletion src/controller/buffer-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export default class BufferController implements ComponentAPI {
browser is able to evict some data from sourcebuffer. Retrying can help recover.
*/
if (this.appendError > hls.config.appendErrorMaxRetry) {
logger.log(
logger.error(
`[buffer-controller]: Failed ${hls.config.appendErrorMaxRetry} times to append segment in sourceBuffer`
);
event.fatal = true;
Expand Down
2 changes: 1 addition & 1 deletion src/controller/stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,11 @@ export default class StreamController

private abortCurrentFrag() {
const fragCurrent = this.fragCurrent;
this.fragCurrent = null;
if (fragCurrent?.loader) {
fragCurrent.loader.abort();
}
this.nextLoadPosition = this.getLoadPosition();
this.fragCurrent = null;
}

protected flushMainBuffer(startOffset: number, endOffset: number) {
Expand Down

0 comments on commit 22d983a

Please sign in to comment.