diff --git a/src/controller/audio-stream-controller.js b/src/controller/audio-stream-controller.js index 7d2ebb52db5..d8284c3a620 100644 --- a/src/controller/audio-stream-controller.js +++ b/src/controller/audio-stream-controller.js @@ -348,7 +348,7 @@ class AudioStreamController extends EventHandler { if (!isNaN(frag.sn)) { this.nextLoadPosition = frag.start + frag.duration; } - hls.trigger(Event.FRAG_LOADING, {frag: frag}); + hls.trigger(Event.FRAG_LOADING, {frag}); this.state = State.FRAG_LOADING; } } @@ -664,6 +664,7 @@ class AudioStreamController extends EventHandler { } if(!fragCurrent.mediaChannels) { + // Set is used because the elements do not repeat fragCurrent.mediaChannels = new Set(); } fragCurrent.mediaChannels.add(data.type); diff --git a/src/controller/buffer-controller.js b/src/controller/buffer-controller.js index adb354019ec..ac20ab43d48 100644 --- a/src/controller/buffer-controller.js +++ b/src/controller/buffer-controller.js @@ -222,14 +222,9 @@ class BufferController extends EventHandler { // count nb of pending segments waiting for appending on this sourcebuffer let pending = this.segments.reduce( (counter, segment) => (segment.parent === parent) ? counter + 1 : counter , 0); - // this.sourceBuffer is better to use than media.buffered as it is closer to the PTS data from the fragments - let timeRanges = new Map(); - for (let type in this.sourceBuffer) { - if (this.sourceBuffer.hasOwnProperty(type)) { - timeRanges.set(type, this.sourceBuffer[type].buffered); - } - } + const bufferedEntries = Object.entries(this.sourceBuffer).map(([k,v]) => [k, v.buffered]); + const timeRanges = new Map(bufferedEntries); this.hls.trigger(Event.BUFFER_APPENDED, { parent, pending, timeRanges }); // don't append in flushing mode diff --git a/src/controller/stream-controller.js b/src/controller/stream-controller.js index 3ddf0ce9f32..53517cd7d64 100644 --- a/src/controller/stream-controller.js +++ b/src/controller/stream-controller.js @@ -1101,6 +1101,7 @@ class StreamController extends EventHandler { } if(!frag.mediaChannels) { + // Set is used because the elements do not repeat frag.mediaChannels = new Set(); } frag.mediaChannels.add(data.type);