@playkit-js/playkit-js-ui 0.78.2 → 0.78.3-canary.0-dbecd05

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playkit-js/playkit-js-ui",
3
- "version": "0.78.2",
3
+ "version": "0.78.3-canary.0-dbecd05",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "kaltura",
@@ -119,6 +119,7 @@
119
119
  }
120
120
 
121
121
  .font-size,
122
+ .font-alignment,
122
123
  .font-color,
123
124
  .font-family,
124
125
  .font-style,
@@ -100,6 +100,11 @@ class CustomCaptionsWindow extends Component<any, any> {
100
100
  active: props.customTextStyle.backgroundColor.every((value, index) => value === standardColors[key][index])
101
101
  }));
102
102
 
103
+ const fontAlignmentOption = player.TextStyle.FontAlignment.map(fontAlignment => ({
104
+ ...fontAlignment,
105
+ active: props.customTextStyle.textAlign === fontAlignment.value
106
+ }));
107
+
103
108
  return (
104
109
  <div className={[style.overlayScreen, style.active].join(' ')}>
105
110
  <form className={[style.form, style.customCaptionForm].join(' ')}>
@@ -111,6 +116,14 @@ class CustomCaptionsWindow extends Component<any, any> {
111
116
  styleName="fontSize"
112
117
  changeCustomStyle={props.changeCustomStyle}
113
118
  />
119
+ <DropDownCaptionsStyle
120
+ addAccessibleChild={props.addAccessibleChild}
121
+ labelId="cvaa.font_alignment_label"
122
+ options={fontAlignmentOption}
123
+ classNames={[style.formGroupRow, style.fontAlignment]}
124
+ styleName="textAlign"
125
+ changeCustomStyle={props.changeCustomStyle}
126
+ />
114
127
  <DropDownCaptionsStyle
115
128
  addAccessibleChild={props.addAccessibleChild}
116
129
  labelId="cvaa.font_color_label"
@@ -173,6 +173,9 @@ function onClickableComponentsHandler(store: any, action: any, player: KalturaPl
173
173
  case 'LiveTag':
174
174
  player.dispatchEvent(new FakeEvent(EventType.USER_CLICKED_LIVE_TAG));
175
175
  break;
176
+ case 'Logo':
177
+ player.dispatchEvent(new FakeEvent(EventType.USER_CLICKED_LOGO, action.payload));
178
+ break;
176
179
 
177
180
  case 'PrePlaybackPlayOverlay':
178
181
  case 'PlayPause':
@@ -5,6 +5,7 @@ import {withText} from 'preact-i18n';
5
5
  import {withPlayer} from '../player';
6
6
  import {withLogger} from '../logger';
7
7
  import {withEventManager} from '../../event';
8
+ import {withEventDispatcher} from '../event-dispatcher';
8
9
 
9
10
  const COMPONENT_NAME = 'Logo';
10
11
 
@@ -32,6 +33,7 @@ const ENTRY_VAR = '{entryId}';
32
33
  @withPlayer
33
34
  @withEventManager
34
35
  @withLogger(COMPONENT_NAME)
36
+ @withEventDispatcher(COMPONENT_NAME)
35
37
  @withText({logoText: 'controls.logo'})
36
38
  class Logo extends Component<any, any> {
37
39
  /**
@@ -72,6 +74,10 @@ class Logo extends Component<any, any> {
72
74
  }
73
75
  }
74
76
 
77
+ _handleOnClick = (): void => {
78
+ this.props.notifyClick({logoUrl: this.state.urlLink});
79
+ };
80
+
75
81
  /**
76
82
  * sets the url with the entry id
77
83
  * @param {string} url - the url configured on the logo
@@ -116,7 +122,13 @@ class Logo extends Component<any, any> {
116
122
  <div
117
123
  className={[style.controlButtonContainer, !props.config.url || !this.state.isUrlClickable ? style.emptyUrl : ''].join(' ')}
118
124
  title={props.config.text}>
119
- <a className={style.controlButton} href={this.state.urlLink} aria-label={props.logoText} target="_blank" rel="noopener noreferrer">
125
+ <a
126
+ onClick={this._handleOnClick}
127
+ className={style.controlButton}
128
+ href={this.state.urlLink}
129
+ aria-label={props.logoText}
130
+ target="_blank"
131
+ rel="noopener noreferrer">
120
132
  <img className={style.icon} src={props.config.img} />
121
133
  </a>
122
134
  </div>
@@ -27,7 +27,9 @@ const mapStateToProps = state => ({
27
27
  previewHoverActive: state.seekbar.previewHoverActive,
28
28
  hidePreview: state.seekbar.hidePreview,
29
29
  hideTimeBubble: state.seekbar.hideTimeBubble,
30
- segments: state.seekbar.segments
30
+ segments: state.seekbar.segments,
31
+ seekbarClasses: state.seekbar.seekbarClasses,
32
+ isPreventSeek: state.seekbar.isPreventSeek
31
33
  });
32
34
 
33
35
  const COMPONENT_NAME = 'SeekBar';
@@ -497,7 +499,7 @@ class SeekBar extends Component<any, any> {
497
499
  * @memberof SeekBar
498
500
  */
499
501
  renderFramePreview(): VNode<any> | undefined {
500
- if (!this.props.showFramePreview || this.props.isMobile) return undefined;
502
+ if (!this.props.showFramePreview || this.props.isMobile || this.props.isPreventSeek) return undefined;
501
503
  return (
502
504
  <div
503
505
  className={this.props.hidePreview ? [style.framePreview, style.hideFramePreview].join(' ') : style.framePreview}
@@ -547,7 +549,7 @@ class SeekBar extends Component<any, any> {
547
549
  render(props: any, state: any): VNode<any> {
548
550
  const virtualProgressWidth = `${(props.virtualTime / props.duration) * 100}%`;
549
551
  const scrubberProgressPosition = `${(props.currentTime / props.duration) * this._seekBarElement?.clientWidth}px`;
550
- const seekbarStyleClass = [style.seekBar];
552
+ const seekbarStyleClass = [style.seekBar, ...props.seekbarClasses];
551
553
  if (props.adBreak) seekbarStyleClass.push(style.adBreak);
552
554
  if (props.isDvr) seekbarStyleClass.push(style.live);
553
555
  if (props.isMobile) seekbarStyleClass.push(style.hover);
@@ -12,6 +12,7 @@ const EventType = {
12
12
  USER_CLICKED_REWIND: `${namespace}-userclickedrewind`,
13
13
  USER_CLICKED_FORWARD: `${namespace}-userclickedforward`,
14
14
  USER_CLICKED_LIVE_TAG: `${namespace}-userclickedlivetag`,
15
+ USER_CLICKED_LOGO: `${namespace}-userclickedlogo`,
15
16
  USER_CLICKED_MUTE: `${namespace}-userclickedmute`,
16
17
  USER_CLICKED_UNMUTE: `${namespace}-userclickedunmute`,
17
18
  USER_CLICKED_ADVANCED_AUDIO_DESCRIPTION: `${namespace}-userclickedadvancedaudiodescription`,
@@ -1,21 +1,26 @@
1
1
  /* eslint-disable @typescript-eslint/explicit-function-return-type */
2
2
  import {SeekbarState} from '../types/reducers/seekbar';
3
3
 
4
+ const entityName = 'seekbar';
5
+
4
6
  export const types = {
5
- UPDATE_SEEKBAR_DRAGGING_STATUS: 'seekbar/UPDATE_SEEKBAR_DRAGGING_STATUS',
6
- UPDATE_SEEKBAR_HOVER_ACTIVE: 'seekbar/UPDATE_SEEKBAR_HOVER_ACTIVE',
7
- UPDATE_SEEKBAR_PREVIEW_HOVER_ACTIVE: 'seekbar/UPDATE_SEEKBAR_PREVIEW_HOVER_ACTIVE',
8
- UPDATE_SEEKBAR_CLIENT_RECT: 'seekbar/UPDATE_SEEKBAR_CLIENT_RECT',
9
- UPDATE_HIDE_SEEKBAR_PREVIEW: 'seekbar/UPDATE_HIDE_SEEKBAR_PREVIEW',
10
- UPDATE_HIDE_SEEKBAR_TIME_BUBBLE: 'seekbar/UPDATE_HIDE_SEEKBAR_TIME_BUBBLE',
11
- UPDATE_CURRENT_TIME: 'seekbar/UPDATE_CURRENT_TIME',
12
- UPDATE_VIRTUAL_TIME: 'seekbar/UPDATE_VIRTUAL_TIME',
13
- UPDATE_HOVERED_SEGMENT: 'seekbar/UPDATE_HOVERED_SEGMENT',
14
- UPDATE_SEEKBAR_SEGMENTS: 'seekbar/UPDATE_SEEKBAR_SEGMENTS',
15
- UPDATE_SEGMENT_END_TIME: 'seekbar/UPDATE_SEGMENT_END_TIME'
7
+ UPDATE_SEEKBAR_DRAGGING_STATUS: `${entityName}/UPDATE_SEEKBAR_DRAGGING_STATUS`,
8
+ UPDATE_SEEKBAR_HOVER_ACTIVE: `${entityName}/UPDATE_SEEKBAR_HOVER_ACTIVE`,
9
+ UPDATE_SEEKBAR_PREVIEW_HOVER_ACTIVE: `${entityName}/UPDATE_SEEKBAR_PREVIEW_HOVER_ACTIVE`,
10
+ UPDATE_SEEKBAR_CLIENT_RECT: `${entityName}/UPDATE_SEEKBAR_CLIENT_RECT`,
11
+ UPDATE_HIDE_SEEKBAR_PREVIEW: `${entityName}/UPDATE_HIDE_SEEKBAR_PREVIEW`,
12
+ UPDATE_HIDE_SEEKBAR_TIME_BUBBLE: `${entityName}/UPDATE_HIDE_SEEKBAR_TIME_BUBBLE`,
13
+ UPDATE_CURRENT_TIME: `${entityName}/UPDATE_CURRENT_TIME`,
14
+ UPDATE_VIRTUAL_TIME: `${entityName}/UPDATE_VIRTUAL_TIME`,
15
+ UPDATE_HOVERED_SEGMENT: `${entityName}/UPDATE_HOVERED_SEGMENT`,
16
+ UPDATE_SEEKBAR_SEGMENTS: `${entityName}/UPDATE_SEEKBAR_SEGMENTS`,
17
+ UPDATE_SEGMENT_END_TIME: `${entityName}/UPDATE_SEGMENT_END_TIME`,
18
+ ADD_SEEKBAR_CLASS: `${entityName}/ADD_SEEKBAR_CLASS`,
19
+ REMOVE_SEEKBAR_CLASS: `${entityName}/REMOVE_SEEKBAR_CLASS`,
20
+ UPDATE_PREVENT_SEEK: `${entityName}/UPDATE_PREVENT_SEEK`
16
21
  };
17
22
 
18
- export const initialState = {
23
+ export const initialState: SeekbarState = {
19
24
  currentTime: 0,
20
25
  virtualTime: 0,
21
26
  draggingActive: false,
@@ -24,7 +29,9 @@ export const initialState = {
24
29
  clientRect: {x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0},
25
30
  hidePreview: false,
26
31
  hideTimeBubble: false,
27
- segments: []
32
+ segments: [],
33
+ seekbarClasses: [],
34
+ isPreventSeek: false
28
35
  };
29
36
 
30
37
  export default (state: SeekbarState = initialState, action: any) => {
@@ -95,6 +102,26 @@ export default (state: SeekbarState = initialState, action: any) => {
95
102
  segments: state.segments.map(segment => (segment.id === action.id ? {...segment, endTime: action.endTime} : segment))
96
103
  };
97
104
 
105
+ case types.ADD_SEEKBAR_CLASS:
106
+ if (state.seekbarClasses.includes(action.className)) {
107
+ return state;
108
+ }
109
+ return {
110
+ ...state,
111
+ seekbarClasses: [...state.seekbarClasses, action.className]
112
+ };
113
+ case types.REMOVE_SEEKBAR_CLASS:
114
+ return {
115
+ ...state,
116
+ seekbarClasses: state.seekbarClasses.filter(c => c !== action.className)
117
+ };
118
+
119
+ case types.UPDATE_PREVENT_SEEK:
120
+ return {
121
+ ...state,
122
+ isPreventSeek: action.isPreventSeek
123
+ };
124
+
98
125
  default:
99
126
  return state;
100
127
  }
@@ -126,5 +153,8 @@ export const actions = {
126
153
  updateVirtualTime: (virtualTime: number) => ({type: types.UPDATE_VIRTUAL_TIME, virtualTime}),
127
154
  updateHoveredSegment: (id: string, isHovered: boolean) => ({type: types.UPDATE_HOVERED_SEGMENT, id, isHovered}),
128
155
  updateSegmentEndTime: (id: string, endTime: number) => ({type: types.UPDATE_SEGMENT_END_TIME, id, endTime}),
129
- updateSeekbarSegments: (segments: any[]) => ({type: types.UPDATE_SEEKBAR_SEGMENTS, segments})
156
+ updateSeekbarSegments: (segments: any[]) => ({type: types.UPDATE_SEEKBAR_SEGMENTS, segments}),
157
+ addSeekbarClass: (className: string) => ({type: types.ADD_SEEKBAR_CLASS, className}),
158
+ removeSeekbarClass: (className: string) => ({type: types.REMOVE_SEEKBAR_CLASS, className}),
159
+ updatePreventSeek: (isPreventSeek: boolean) => ({type: types.UPDATE_PREVENT_SEEK, isPreventSeek})
130
160
  } as const;
@@ -25,4 +25,6 @@ export interface SeekbarState {
25
25
  hidePreview: boolean;
26
26
  hideTimeBubble: boolean;
27
27
  segments: SeekbarSegment[];
28
+ seekbarClasses: string[];
29
+ isPreventSeek: boolean;
28
30
  }
@@ -85,6 +85,7 @@
85
85
  "edit_caption": "Edit caption",
86
86
  "size_label": "Size",
87
87
  "font_color_label": "Font color",
88
+ "font_alignment_label": "Font alignment",
88
89
  "font_family_label": "Font family",
89
90
  "font_style_label": "Font style",
90
91
  "font_opacity_label": "Font opacity",