Skip to content

Commit

Permalink
fix(FEC-12189): Stream doesn't start if open a program with a bookmark (
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanTGold authored Jun 26, 2022
1 parent f30030a commit 305e772
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ 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');
adapterConfig.lowLatencyMode = Utils.Object.getPropertyPath(config, 'streaming.lowLatencyMode');
}
if (Utils.Object.hasPropertyPath(config, 'sources.options')) {
const options = config.sources.options;
Expand Down Expand Up @@ -755,6 +755,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
}

_onLoadedData(): void {
this._setLowLatencyMode();
const segmentDuration = this.getSegmentDuration();
this._seekRangeStart = this._shaka.seekRange().start;
this._startOverTimeout = setTimeout(() => {
Expand All @@ -765,6 +766,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.
Expand Down
66 changes: 66 additions & 0 deletions test/src/dash-adapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,72 @@ describe('DashAdapter: load', () => {
});
});

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, () => {
dashInstance._shaka.getConfiguration().streaming.lowLatencyMode.should.equal(false);
done();
});

dashInstance.load().then(() => {
video.play();
});
} catch (e) {
done(e);
}
});

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, () => {
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 - 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
Expand Down

0 comments on commit 305e772

Please sign in to comment.