-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### Description of the Changes resolves: https://kaltura.atlassian.net/browse/FEC-14087 ### CheckLists - [ ] changes have been done against master branch, and PR does not conflict - [ ] new unit / functional tests have been added (whenever applicable) - [ ] test are passing in local environment - [ ] Travis tests are passing (or test results are not worse than on master branch :)) - [ ] Docs have been updated
- Loading branch information
1 parent
912c31b
commit 3c2e365
Showing
8 changed files
with
60 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
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
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 |
---|---|---|
@@ -1,10 +1,35 @@ | ||
//@flow | ||
import Track from './track'; | ||
|
||
enum FlavorAssetTags { | ||
AUDIO_ONLY = 'audio_only', | ||
AUDIO_DESCRIPTION = 'audio_description' | ||
} | ||
|
||
/** | ||
* Audio track representation of the player. | ||
* @classdesc | ||
*/ | ||
class AudioTrack extends Track {} | ||
|
||
export function audioDescriptionTrackHandler(tracks: AudioTrack[], audioFlavors?: Array<any>): void { | ||
if (tracks?.length && audioFlavors?.length) { | ||
let audioTracksIndex = 0; | ||
// iterate over the audio tracks and set the isAudioDescription flag based on the audioFlavors tags | ||
tracks.forEach((track) => { | ||
if (track instanceof AudioTrack) { | ||
const isAudioDescription = audioFlavors[audioTracksIndex]?.tags?.includes(FlavorAssetTags.AUDIO_DESCRIPTION); | ||
if (isAudioDescription) { | ||
// set the language to ad-<language> for audio description tracks | ||
track.language = `ad-${track.language}`; | ||
if (!audioFlavors?.[audioTracksIndex]?.label) { | ||
// add "Audio Description" to the label if custom label is not provided | ||
track.label = `${track.label} - Audio Description`; | ||
} | ||
} | ||
audioTracksIndex++; | ||
} | ||
}); | ||
} | ||
} | ||
|
||
export default AudioTrack; |
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
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