Skip to content

Commit

Permalink
feat(FEC-10766): create text config section and option for styling (#387
Browse files Browse the repository at this point in the history
)

Issue: text track doesn't have a config for styling, there is only an API for styling.
Solution: create a text container for the text track and add the options for styling the text track.
  • Loading branch information
Yuvalke authored Dec 29, 2020
1 parent 75acb47 commit dac194d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions flow-typed/types/kaltura-player-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare type KPOptionsObject = {
targetId: string,
log?: KPLogConfigObject,
disableUserCache?: boolean,
text?: PKTextConfigObject,
playback?: PKPlaybackConfigObject,
sources?: PKSourcesConfigObject,
plugins: KPPluginsConfigObject,
Expand Down
12 changes: 9 additions & 3 deletions src/common/utils/setup-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,10 @@ function checkNativeHlsSupport(options: KPOptionsObject): void {
*/
function checkNativeTextTracksSupport(options: KPOptionsObject): void {
if ((Env.isMacOS && Env.isSafari) || Env.isIOS) {
const useNativeTextTrack = Utils.Object.getPropertyPath(options, 'playback.useNativeTextTrack');
const useNativeTextTrack = Utils.Object.getPropertyPath(options, 'text.useNativeTextTrack');
if (typeof useNativeTextTrack !== 'boolean') {
Utils.Object.mergeDeep(options, {
playback: {
text: {
useNativeTextTrack: true
}
});
Expand Down Expand Up @@ -561,7 +561,13 @@ function supportLegacyOptions(options: Object): PartialKPOptionsObject {
['metadata.poster', 'sources.poster'],
['metadata', 'sources.metadata'],
['logLevel', 'log.level'],
['ui.components.fullscreen.inBrowserFullscreenForIOS', 'playback.inBrowserFullscreen']
['ui.components.fullscreen.inBrowserFullscreenForIOS', 'playback.inBrowserFullscreen'],
['playback.enableCEA708Captions', 'text.enableCEA708Captions'],
['playback.useNativeTextTrack', 'text.useNativeTextTrack'],
['playback.captionsTextTrack1Label', 'text.captionsTextTrack1Label'],
['playback.captionsTextTrack1LanguageCode', 'text.captionsTextTrack1LanguageCode'],
['playback.captionsTextTrack2Label', 'text.captionsTextTrack2Label'],
['playback.captionsTextTrack2LanguageCode', 'text.captionsTextTrack2LanguageCode']
];
removePlayerEntry();
moves.forEach(move => moveProp(move[0], move[1]));
Expand Down
4 changes: 4 additions & 0 deletions src/kaltura-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ class KalturaPlayer extends FakeEventTarget {
this._localPlayer.setTextDisplaySettings(settings);
}

get textDisplaySetting(): Object {
return this._localPlayer.textDisplaySetting;
}

isFullscreen(): boolean {
return this._localPlayer.isFullscreen();
}
Expand Down
4 changes: 3 additions & 1 deletion test/src/utils/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ function getConfigStructure() {
adBreaks: []
},
sources: {},
text: {
enableCEA708Captions: true
},
playback: {
enableCEA708Captions: true,
preload: 'none',
autoplay: false,
muted: false,
Expand Down

0 comments on commit dac194d

Please sign in to comment.