-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FEC-8875): when an external caption format is DFXP return the we…
…bvtt url (#81) * use webvtt url when the caption format is DFXP or CAP * add tests + fix pr
- Loading branch information
1 parent
817111b
commit 49581ad
Showing
2 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import {ExternalCaptionsBuilder} from '../../../../src/k-provider/ovp/external-captions-builder'; | ||
|
||
describe('external captions parser', function() { | ||
const playbackCaptions = [ | ||
{ | ||
format: '1', | ||
label: 'Eng', | ||
language: 'English', | ||
languageCode: 'EN', | ||
objectType: 'KalturaCaptionPlaybackPluginData', | ||
url: 'regularUrl', | ||
webVttUrl: 'webVttUrl' | ||
}, | ||
{ | ||
format: '3', | ||
label: 'FRA', | ||
language: 'FRENCH', | ||
languageCode: 'FR', | ||
objectType: 'KalturaCaptionPlaybackPluginData', | ||
url: 'regularUrl', | ||
webVttUrl: 'webVttUrl' | ||
}, | ||
{ | ||
format: '2', | ||
label: 'RUS', | ||
language: 'Russian', | ||
languageCode: 'RU', | ||
objectType: 'KalturaCaptionPlaybackPluginData', | ||
url: 'regularUrl', | ||
webVttUrl: 'webVttUrl' | ||
} | ||
]; | ||
|
||
describe('createConfig', () => { | ||
it('should return an empty config', () => { | ||
const captions = ExternalCaptionsBuilder.createConfig([]); | ||
captions.length.should.equal(0); | ||
}); | ||
it('should return an array with 3 captions', () => { | ||
const captions = ExternalCaptionsBuilder.createConfig(playbackCaptions); | ||
captions.length.should.equal(3); | ||
}); | ||
it('should return a caption with regular url with srt type', () => { | ||
const captions = ExternalCaptionsBuilder.createConfig([playbackCaptions[0]]); | ||
captions[0].url.should.equal('regularUrl'); | ||
captions[0].type.should.equal('srt'); | ||
}); | ||
it('should return a caption with regular url with vtt type', () => { | ||
const captions = ExternalCaptionsBuilder.createConfig([playbackCaptions[1]]); | ||
captions[0].url.should.equal('regularUrl'); | ||
captions[0].type.should.equal('vtt'); | ||
}); | ||
it('should return a caption with url : webvtturl with a vtt type', () => { | ||
const captions = ExternalCaptionsBuilder.createConfig([playbackCaptions[2]]); | ||
captions[0].url.should.equal('webVttUrl'); | ||
captions[0].type.should.equal('vtt'); | ||
}); | ||
}); | ||
}); |