Skip to content

Commit

Permalink
feat(FEC-9631): add support for out of band text tracks on cast sdk (#…
Browse files Browse the repository at this point in the history
…319)

Update the local player on cast disconnection with the captions from the cast snapshot 

Solves FEC-9631

Related to kaltura/playkit-js-cast-sender#32
  • Loading branch information
yairans authored Jun 1, 2020
1 parent 75690a3 commit 16562b6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/common/cast/remote-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ function onRemoteDeviceDisconnected(payload: RemoteDisconnectedPayload): void {
const mediaConfig = snapshot.mediaConfig;
snapshot.config.playback.autoplay = true;
configurePlayback.call(this, snapshot.config.playback);
this._eventManager.listenOnce(this, this.Event.Core.CHANGE_SOURCE_ENDED, () => {
configureTracks.call(this, snapshot.config.sources);
});
let mediaPromise;
if (mediaInfo) {
mediaPromise = this.loadMedia(mediaInfo);
Expand Down Expand Up @@ -239,6 +242,17 @@ function configurePlayback(playbackConfig: Object): void {
});
}

function configureTracks(sourcesConfig: Object): void {
if (sourcesConfig.captions.length) {
const {captions} = sourcesConfig;
this.configure({
sources: {
captions
}
});
}
}

function setInitialTracks(playbackConfig: Object): void {
if (playbackConfig.audioLanguage) {
const audioTrack = this.getTracks(TrackType.AUDIO).find(t => t.language === playbackConfig.audioLanguage);
Expand Down

0 comments on commit 16562b6

Please sign in to comment.