Skip to content

Commit

Permalink
fix(FEC-10699): objectType KalturaLiveAsset should check enableTrickP…
Browse files Browse the repository at this point in the history
…lay even if externalIds > 0 (#137)

I switched the if else order to give precedence to KalturaLiveAsset enableTrickPlay
Updated tests accordingly
  • Loading branch information
RoyBregman authored Jan 28, 2021
1 parent de1bc58 commit 66c15f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/k-provider/ott/provider-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ const MediaTypeCombinations: {[mediaType: string]: Object} = {
[KalturaAsset.Type.MEDIA]: {
[KalturaPlaybackContext.Type.TRAILER]: () => ({type: MediaEntry.Type.VOD}),
[KalturaPlaybackContext.Type.PLAYBACK]: mediaAssetData => {
if (parseInt(mediaAssetData.externalIds) > 0) {
return {type: MediaEntry.Type.LIVE, dvrStatus: MediaEntry.DvrStatus.OFF};
} else if (mediaAssetData.objectType === LIVE_ASST_OBJECT_TYPE) {
if (mediaAssetData.objectType === LIVE_ASST_OBJECT_TYPE) {
return {type: MediaEntry.Type.LIVE, dvrStatus: mediaAssetData.enableTrickPlay ? MediaEntry.DvrStatus.ON : MediaEntry.DvrStatus.OFF};
} else if (parseInt(mediaAssetData.externalIds) > 0) {
return {type: MediaEntry.Type.LIVE, dvrStatus: MediaEntry.DvrStatus.OFF};
}
return {type: MediaEntry.Type.VOD};
}
Expand Down
8 changes: 4 additions & 4 deletions test/src/k-provider/ott/provider-parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {MediaLiveAssetData} from './be-data';

describe('provider parser', function () {
describe('_getMediaType', () => {
it('should check KalturaLiveAsset with externalIds returns live with dvr false', done => {
it('should check KalturaLiveAsset with enableTrickPlay true and externalIds > 0 returns live with dvr', done => {
const typeData = OTTProviderParser._getMediaType(MediaLiveAssetData, 'media', 'PLAYBACK');
typeData.type.should.equal('Live');
typeData.dvrStatus.should.equal(0);
typeData.dvrStatus.should.equal(1);
done();
});
it('should check KalturaLiveAsset with trickPlay false returns live with dvr false', done => {
it('should check KalturaLiveAsset with enableTrickPlay false returns live with dvr false', done => {
const MediaLiveAssetDataCopy = JSON.parse(JSON.stringify(MediaLiveAssetData));
MediaLiveAssetDataCopy.externalIds = 0;
MediaLiveAssetDataCopy.enableTrickPlay = false;
Expand All @@ -18,7 +18,7 @@ describe('provider parser', function () {
typeData.dvrStatus.should.equal(0);
done();
});
it('should check KalturaLiveAsset with trickPlay true returns live with dvr true', done => {
it('should check KalturaLiveAsset with enableTrickPlay true returns live with dvr true', done => {
const MediaLiveAssetDataCopy = JSON.parse(JSON.stringify(MediaLiveAssetData));
MediaLiveAssetDataCopy.externalIds = 0;
const typeData = OTTProviderParser._getMediaType(MediaLiveAssetDataCopy, 'media', 'PLAYBACK');
Expand Down

0 comments on commit 66c15f3

Please sign in to comment.