Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FEC-12615): add configuration to toggle emsg listener #212

Merged
merged 3 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
if (typeof streaming.lowLatencyMode === 'boolean') {
adapterConfig.lowLatencyMode = streaming.lowLatencyMode;
}
if (typeof streaming.trackEmsgEvents === 'boolean') {
adapterConfig.trackEmsgEvents = streaming.trackEmsgEvents;
}
}
if (Utils.Object.hasPropertyPath(config, 'sources.options')) {
const options = config.sources.options;
Expand Down Expand Up @@ -276,6 +279,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
if (Utils.Object.hasPropertyPath(config, 'playback.options.html5.dash')) {
Utils.Object.mergeDeep(adapterConfig.shakaConfig, config.playback.options.html5.dash);

//for backward compatibility with shaka version < 4
if (Utils.Object.hasPropertyPath(adapterConfig.shakaConfig, 'manifest.dash.defaultPresentationDelay')) {
adapterConfig.shakaConfig.manifest.defaultPresentationDelay = adapterConfig.shakaConfig.manifest.dash.defaultPresentationDelay;
delete adapterConfig.shakaConfig.manifest.dash.defaultPresentationDelay;
Expand Down Expand Up @@ -735,13 +739,15 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
this._eventManager.listen(this._shaka, ShakaEvent.ADAPTATION, this._adapterEventsBindings.adaptation);
this._eventManager.listen(this._shaka, ShakaEvent.ERROR, this._adapterEventsBindings.error);
this._eventManager.listen(this._shaka, ShakaEvent.DRM_SESSION_UPDATE, this._adapterEventsBindings.drmsessionupdate);
this._eventManager.listen(this._shaka, ShakaEvent.EMSG, this._adapterEventsBindings.emsg);
this._eventManager.listen(this._videoElement, EventType.WAITING, this._adapterEventsBindings.waiting);
this._eventManager.listen(this._videoElement, EventType.PLAYING, this._adapterEventsBindings.playing);
this._eventManager.listen(this._videoElement, EventType.LOADED_DATA, () => this._onLoadedData());
this._eventManager.listenOnce(this._videoElement, EventType.PLAYING, () => {
this._eventManager.listen(this._shaka, ShakaEvent.BUFFERING, this._adapterEventsBindings.buffering);
});
if (this._config.trackEmsgEvents) {
giladna marked this conversation as resolved.
Show resolved Hide resolved
this._eventManager.listen(this._shaka, ShakaEvent.EMSG, this._adapterEventsBindings.emsg);
}

// called when a resource is downloaded
this._shaka.getNetworkingEngine().registerResponseFilter((type, response) => {
Expand Down
3 changes: 2 additions & 1 deletion src/default-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"restrictions": {}
}
},
"forceRedirectExternalStreams": false
"forceRedirectExternalStreams": false,
"trackEmsgEvents": true
}