From 6fd8b512bf7785634d4ab360a77fd36bcacacd57 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Sun, 12 Jun 2022 18:37:56 +0300 Subject: [PATCH 1/8] fix(FEC-12189): Stream doesn't start if open a program with a bookmark --- src/dash-adapter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dash-adapter.js b/src/dash-adapter.js index 738c24ea..5a7eb76a 100644 --- a/src/dash-adapter.js +++ b/src/dash-adapter.js @@ -243,7 +243,11 @@ export default class DashAdapter extends BaseMediaSourceAdapter { } if (Utils.Object.hasPropertyPath(config, 'streaming')) { adapterConfig.forceBreakStall = Utils.Object.getPropertyPath(config, 'streaming.forceBreakStall'); - adapterConfig.shakaConfig.streaming.lowLatencyMode = Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode'); + if (typeof Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode') === 'boolean') { + adapterConfig.shakaConfig.streaming.lowLatencyMode = Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode'); + } else { + adapterConfig.shakaConfig.streaming.lowLatencyMode = this.isLive ? true : false; + } } if (Utils.Object.hasPropertyPath(config, 'sources.options')) { const options = config.sources.options; From 3a21e94ca9c1066fe59010521473acd7b5552c65 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Sun, 12 Jun 2022 18:50:32 +0300 Subject: [PATCH 2/8] fix --- src/dash-adapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dash-adapter.js b/src/dash-adapter.js index 5a7eb76a..f4fa530d 100644 --- a/src/dash-adapter.js +++ b/src/dash-adapter.js @@ -246,7 +246,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter { if (typeof Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode') === 'boolean') { adapterConfig.shakaConfig.streaming.lowLatencyMode = Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode'); } else { - adapterConfig.shakaConfig.streaming.lowLatencyMode = this.isLive ? true : false; + adapterConfig.shakaConfig.streaming.lowLatencyMode = this.isLive() ? true : false; } } if (Utils.Object.hasPropertyPath(config, 'sources.options')) { From ad01ca3fec71806a1d07aa3ff19cd25212cca3c7 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Mon, 13 Jun 2022 15:35:16 +0300 Subject: [PATCH 3/8] fix --- src/dash-adapter.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dash-adapter.js b/src/dash-adapter.js index f4fa530d..c853f59a 100644 --- a/src/dash-adapter.js +++ b/src/dash-adapter.js @@ -245,8 +245,6 @@ export default class DashAdapter extends BaseMediaSourceAdapter { adapterConfig.forceBreakStall = Utils.Object.getPropertyPath(config, 'streaming.forceBreakStall'); if (typeof Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode') === 'boolean') { adapterConfig.shakaConfig.streaming.lowLatencyMode = Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode'); - } else { - adapterConfig.shakaConfig.streaming.lowLatencyMode = this.isLive() ? true : false; } } if (Utils.Object.hasPropertyPath(config, 'sources.options')) { @@ -759,6 +757,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter { } _onLoadedData(): void { + this._setLowLatencyMode(); const segmentDuration = this.getSegmentDuration(); this._seekRangeStart = this._shaka.seekRange().start; this._startOverTimeout = setTimeout(() => { @@ -769,6 +768,14 @@ export default class DashAdapter extends BaseMediaSourceAdapter { }, (segmentDuration + 1) * 1000); } + _setLowLatencyMode() { + this._shaka.configure({ + streaming: { + lowLatencyMode: this.isLive() + } + }); + } + /** * Custom parser to retrieve image adaptation sets. * @param {ArrayBuffer} manifestBuffer - The array buffer manifest from the response. From 3e32c92b5a253d7103385e1cc04320f2c85c8101 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Mon, 13 Jun 2022 16:44:18 +0300 Subject: [PATCH 4/8] fix --- src/dash-adapter.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/dash-adapter.js b/src/dash-adapter.js index c853f59a..3235e7cf 100644 --- a/src/dash-adapter.js +++ b/src/dash-adapter.js @@ -243,9 +243,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter { } if (Utils.Object.hasPropertyPath(config, 'streaming')) { adapterConfig.forceBreakStall = Utils.Object.getPropertyPath(config, 'streaming.forceBreakStall'); - if (typeof Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode') === 'boolean') { - adapterConfig.shakaConfig.streaming.lowLatencyMode = Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode'); - } + adapterConfig.lowLatencyMode = Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode'); } if (Utils.Object.hasPropertyPath(config, 'sources.options')) { const options = config.sources.options; @@ -771,7 +769,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter { _setLowLatencyMode() { this._shaka.configure({ streaming: { - lowLatencyMode: this.isLive() + lowLatencyMode: typeof this._config.lowLatencyMode === 'boolean' ? this._config.lowLatencyMode : this.isLive() } }); } From 3c96006d0cf5266679db451b8f8c314722caef8b Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Thu, 16 Jun 2022 18:15:34 +0300 Subject: [PATCH 5/8] add tests --- test/src/dash-adapter.spec.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/src/dash-adapter.spec.js b/test/src/dash-adapter.spec.js index 66b79b39..cc8c8eca 100644 --- a/test/src/dash-adapter.spec.js +++ b/test/src/dash-adapter.spec.js @@ -213,6 +213,38 @@ describe('DashAdapter: load', () => { }); }); + it('should set streaming.lowLatencyMod config to false on vod by default', done => { + try { + dashInstance = DashAdapter.createAdapter(video, vodSource, config); + video.addEventListener(EventType.LOADED_DATA, () => { + dashInstance._shaka.getConfiguration().streaming.lowLatencyMode.should.equal(false); + done(); + }); + + dashInstance.load().then(() => { + video.play(); + }); + } catch (e) { + done(e); + } + }); + + it('should set streaming.lowLatencyMod config to true on live by default', done => { + try { + dashInstance = DashAdapter.createAdapter(video, liveSource, config); + video.addEventListener(EventType.LOADED_DATA, () => { + dashInstance._shaka.getConfiguration().streaming.lowLatencyMode.should.equal(true); + done(); + }); + + dashInstance.load().then(() => { + video.play(); + }); + } catch (e) { + done(e); + } + }); + it('should load successfully when given a valid video to play', done => { dashInstance = DashAdapter.createAdapter(video, vodSource, config); dashInstance From 6e62a15dad7e5c696deff03d0bd8fa58e9a2bfa1 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Thu, 23 Jun 2022 16:09:21 +0300 Subject: [PATCH 6/8] add unit tests --- test/src/dash-adapter.spec.js | 38 +++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/test/src/dash-adapter.spec.js b/test/src/dash-adapter.spec.js index cc8c8eca..60c7b36e 100644 --- a/test/src/dash-adapter.spec.js +++ b/test/src/dash-adapter.spec.js @@ -213,7 +213,7 @@ describe('DashAdapter: load', () => { }); }); - it('should set streaming.lowLatencyMod config to false on vod by default', done => { + it('should set streaming.lowLatencyMode config to false on vod by default', done => { try { dashInstance = DashAdapter.createAdapter(video, vodSource, config); video.addEventListener(EventType.LOADED_DATA, () => { @@ -229,7 +229,7 @@ describe('DashAdapter: load', () => { } }); - it('should set streaming.lowLatencyMod config to true on live by default', done => { + it('should set streaming.lowLatencyMode config to true on live by default', done => { try { dashInstance = DashAdapter.createAdapter(video, liveSource, config); video.addEventListener(EventType.LOADED_DATA, () => { @@ -245,6 +245,40 @@ describe('DashAdapter: load', () => { } }); + it('should take the streaming.lowLatencyMode value from config when configured manually - vod', done => { + try { + const playerConfig = {...config, streaming: {lowLatencyMode: true}}; + dashInstance = DashAdapter.createAdapter(video, vodSource, playerConfig); + video.addEventListener(EventType.LOADED_DATA, () => { + dashInstance._shaka.getConfiguration().streaming.lowLatencyMode.should.equal(true); + done(); + }); + + dashInstance.load().then(() => { + video.play(); + }); + } catch (e) { + done(e); + } + }); + + it('should take the streaming.lowLatencyMode value from config when configured manually - live', done => { + try { + const playerConfig = {...config, streaming: {lowLatencyMode: false}}; + dashInstance = DashAdapter.createAdapter(video, vodSource, playerConfig); + video.addEventListener(EventType.LOADED_DATA, () => { + dashInstance._shaka.getConfiguration().streaming.lowLatencyMode.should.equal(false); + done(); + }); + + dashInstance.load().then(() => { + video.play(); + }); + } catch (e) { + done(e); + } + }); + it('should load successfully when given a valid video to play', done => { dashInstance = DashAdapter.createAdapter(video, vodSource, config); dashInstance From e74270f955ae64039c524982e9f3d5662cb4a357 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Sun, 2 Oct 2022 13:52:30 +0200 Subject: [PATCH 7/8] fix(FEC-12189): Stream doesn't start if open a program with a bookmark --- src/dash-adapter.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/dash-adapter.js b/src/dash-adapter.js index e5ef5b3a..db5624ef 100644 --- a/src/dash-adapter.js +++ b/src/dash-adapter.js @@ -243,8 +243,13 @@ export default class DashAdapter extends BaseMediaSourceAdapter { adapterConfig.useShakaTextTrackDisplay = Utils.Object.getPropertyPath(config, 'text.useShakaTextTrackDisplay'); } if (Utils.Object.hasPropertyPath(config, 'streaming')) { - adapterConfig.forceBreakStall = Utils.Object.getPropertyPath(config, 'streaming.forceBreakStall'); - adapterConfig.lowLatencyMode = Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode'); + const {streaming} = config; + if (typeof streaming.forceBreakStall === 'boolean') { + adapterConfig.forceBreakStall = streaming.forceBreakStall; + } + if (typeof streaming.lowLatencyMode === 'boolean') { + adapterConfig.lowLatencyMode = streaming.lowLatencyMode; + } } if (Utils.Object.hasPropertyPath(config, 'sources.options')) { const options = config.sources.options; @@ -769,7 +774,6 @@ export default class DashAdapter extends BaseMediaSourceAdapter { } _onLoadedData(): void { - this._setLowLatencyMode(); const segmentDuration = this.getSegmentDuration(); this._seekRangeStart = this._shaka.seekRange().start; this._startOverTimeout = setTimeout(() => { @@ -780,14 +784,6 @@ export default class DashAdapter extends BaseMediaSourceAdapter { }, (segmentDuration + 1) * 1000); } - _setLowLatencyMode() { - this._shaka.configure({ - streaming: { - lowLatencyMode: typeof this._config.lowLatencyMode === 'boolean' ? this._config.lowLatencyMode : this.isLive() - } - }); - } - /** * Custom parser to retrieve image adaptation sets. * @param {ArrayBuffer} manifestBuffer - The array buffer manifest from the response. From 73ea1d22abb6edea9f00a1e5f04d0cac8496fc28 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Sun, 2 Oct 2022 14:08:45 +0200 Subject: [PATCH 8/8] revert --- src/dash-adapter.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dash-adapter.js b/src/dash-adapter.js index db5624ef..50fe2745 100644 --- a/src/dash-adapter.js +++ b/src/dash-adapter.js @@ -774,6 +774,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter { } _onLoadedData(): void { + this._setLowLatencyMode(); const segmentDuration = this.getSegmentDuration(); this._seekRangeStart = this._shaka.seekRange().start; this._startOverTimeout = setTimeout(() => { @@ -784,6 +785,14 @@ export default class DashAdapter extends BaseMediaSourceAdapter { }, (segmentDuration + 1) * 1000); } + _setLowLatencyMode() { + this._shaka.configure({ + streaming: { + lowLatencyMode: typeof this._config.lowLatencyMode === 'boolean' ? this._config.lowLatencyMode : this.isLive() + } + }); + } + /** * Custom parser to retrieve image adaptation sets. * @param {ArrayBuffer} manifestBuffer - The array buffer manifest from the response.