Skip to content

Commit

Permalink
fix(FEC-12243): simulive - The live stream will show the captions fro…
Browse files Browse the repository at this point in the history
…m the Simulive entry (#178)

**the issue:**
when playing simulive entry with external captions and the player fallbacks to real live stream - the captions from the simulive entry are displayed on the live stream.

**the solution:**
add captions source to the mediaEntry sources only if the media type is not live.
Note- needed to move fillBaseData before the if block in order to have mediaEntry.type initialized.

Solves FEC-12243
  • Loading branch information
lianbenjamin authored May 25, 2022
1 parent 94f3a88 commit 8339e96
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/k-provider/ovp/provider-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ class OVPProviderParser {
const kalturaSources = playbackContext.sources;

mediaEntry.sources = OVPProviderParser._getParsedSources(kalturaSources, ks, partnerId, uiConfId, entry, playbackContext);
if (OVPConfiguration.get().useApiCaptions && playbackContext.data.playbackCaptions) {
OVPProviderParser._fillBaseData(mediaEntry, entry, metadataList);
if (mediaEntry.type !== MediaEntry.Type.LIVE && OVPConfiguration.get().useApiCaptions && playbackContext.data.playbackCaptions) {
mediaEntry.sources.captions = ExternalCaptionsBuilder.createConfig(playbackContext.data.playbackCaptions, ks);
}
OVPProviderParser._fillBaseData(mediaEntry, entry, metadataList);
return mediaEntry;
}

Expand Down
73 changes: 71 additions & 2 deletions test/src/k-provider/ovp/provider-parser-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@ const youtubeMediaEntryData = [
hasError: false,
data: {
sources: [],
playbackCaptions: [],
playbackCaptions: [
{
label: 'Hebrew',
format: '1',
language: 'Hebrew',
webVttUrl:
'https://cfvod.kaltura.com/api_v3/index.php/service/caption_captionasset/action/serveWebVTT/captionAssetId/1_kwipd4sf/segmentIndex/-1/version/1/captions.vtt',
url: 'https://cfvod.kaltura.com/api_v3/index.php/service/caption_captionAsset/action/serve/captionAssetId/1_kwipd4sf',
isDefault: true,
languageCode: 'he',
objectType: 'KalturaCaptionPlaybackPluginData'
}
],
flavorAssets: [],
actions: [],
messages: [],
Expand Down Expand Up @@ -68,4 +80,61 @@ const youtubeMediaEntryResult = {
poster: 'https://cfvod.kaltura.com/p/1111/sp/1111/thumbnail/entry_id/1234/version/100001'
};

export {youtubeMediaEntryData, youtubeMediaEntryResult};
const liveMediaEntryData = [
'',
1740481,
null,
{
entry: {
id: '1234',
status: 2,
referenceId: 'abcdefg',
name: 'test live entry',
description: 'live description',
dataUrl: 'https://cdnapisec.kaltura.com/p/1111/sp/1111/playManifest/entryId/1234/format/url/protocol/https',
type: 7,
entryType: 7,
duration: 0,
poster: 'https://cfvod.kaltura.com/p/1111/sp/1111/thumbnail/entry_id/1234/version/100001',
tags: ''
},
playBackContextResult: {
hasError: false,
data: {
sources: [],
playbackCaptions: [
{
label: 'Hebrew',
format: '1',
language: 'Hebrew',
webVttUrl:
'https://cfvod.kaltura.com/api_v3/index.php/service/caption_captionasset/action/serveWebVTT/captionAssetId/1_kwipd4sf/segmentIndex/-1/version/1/captions.vtt',
url: 'https://cfvod.kaltura.com/api_v3/index.php/service/caption_captionAsset/action/serve/captionAssetId/1_kwipd4sf',
isDefault: true,
languageCode: 'he',
objectType: 'KalturaCaptionPlaybackPluginData'
}
],
flavorAssets: [],
actions: [],
messages: [],
objectType: 'KalturaPlaybackContext'
},
sources: [],
actions: [],
messages: [],
flavorAssets: []
},
metadataListResult: {
hasError: false,
data: {
objects: [],
totalCount: 0,
objectType: 'KalturaMetadataListResponse'
},
totalCount: 0
}
}
];

export {youtubeMediaEntryData, youtubeMediaEntryResult, liveMediaEntryData};
13 changes: 12 additions & 1 deletion test/src/k-provider/ovp/provider-parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
kalturaSourceProtocolMismatch,
kalturaSourceProtocolMismatchFlavorAssets
} from './playback-sources-data';
import {youtubeMediaEntryResult, youtubeMediaEntryData} from './provider-parser-data';
import {youtubeMediaEntryResult, youtubeMediaEntryData, liveMediaEntryData} from './provider-parser-data';

describe('provider parser', function () {
let sandbox;
Expand Down Expand Up @@ -81,5 +81,16 @@ describe('provider parser', function () {
Object.keys(mediaEntryObject).forEach(key => mediaEntryObject[key] === undefined && delete mediaEntryObject[key]);
mediaEntryObject.should.deep.equal(youtubeMediaEntryResult);
});

it('should add external captions to the media sources', () => {
const mediaEntry = OVPProviderParser.getMediaEntry(...youtubeMediaEntryData);
mediaEntry.sources.should.haveOwnProperty('captions');
mediaEntry.sources.captions.length.should.equal(1);
});

it('should not add external captions to live media', () => {
const mediaEntry = OVPProviderParser.getMediaEntry(...liveMediaEntryData);
mediaEntry.sources.should.not.haveOwnProperty('captions');
});
});
});

0 comments on commit 8339e96

Please sign in to comment.