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

feat(FEC-13871): set the entry name to navigator media metadata #765

Merged
merged 8 commits into from
Apr 17, 2024
7 changes: 7 additions & 0 deletions src/kaltura-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export class KalturaPlayer extends FakeEventTarget {
this._appPluginConfig = mergedPluginsConfigAndFromApp[1];
this.configure(getDefaultRedirectOptions({ sources: this.sources }, mediaConfig));
this.setMedia(mediaConfig);
this._configureMediaMetadata(mediaConfig);
return mediaConfig;
} catch (e) {
const category = getErrorCategory(e);
Expand Down Expand Up @@ -823,6 +824,12 @@ export class KalturaPlayer extends FakeEventTarget {
return this._localPlayer.Error;
}

private _configureMediaMetadata(mediaConfig: ProviderMediaConfigObject): void {
// here we can provide information about the media, to a device that is playing it
// set the media metadata title to the name of the entry
navigator.mediaSession.metadata = new MediaMetadata({ title: mediaConfig.sources.metadata.name });
}

private _addBindings(): void {
this._eventManager.listen(this, CoreEventType.CHANGE_SOURCE_STARTED, () => this._onChangeSourceStarted());
this._eventManager.listen(this, CoreEventType.CHANGE_SOURCE_ENDED, () => this._onChangeSourceEnded());
Expand Down
Loading