@applicaster/zapp-react-native-utils 15.0.0-alpha.8526950782 → 15.0.0-alpha.8680244503
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/actionsExecutor/ActionExecutorContext.tsx +3 -6
- package/actionsExecutor/feedDecorator.ts +6 -6
- package/adsUtils/index.ts +2 -2
- package/analyticsUtils/README.md +1 -1
- package/appUtils/HooksManager/index.ts +10 -10
- package/appUtils/accessibilityManager/hooks.ts +20 -13
- package/appUtils/accessibilityManager/index.ts +28 -1
- package/appUtils/accessibilityManager/utils.ts +36 -5
- package/appUtils/keyCodes/keys/keys.web.ts +1 -4
- package/appUtils/orientationHelper.ts +2 -4
- package/appUtils/platform/platformUtils.ts +115 -16
- package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +94 -4
- package/appUtils/playerManager/OverlayObserver/utils.ts +32 -20
- package/appUtils/playerManager/playerNative.ts +29 -16
- package/cellUtils/index.ts +32 -0
- package/configurationUtils/__tests__/manifestKeyParser.test.ts +26 -26
- package/manifestUtils/defaultManifestConfigurations/player.js +36 -1
- package/manifestUtils/keys.js +21 -0
- package/manifestUtils/sharedConfiguration/screenPicker/utils.js +1 -0
- package/manifestUtils/tvAction/container/index.js +1 -1
- package/package.json +2 -2
- package/playerUtils/usePlayerTTS.ts +8 -3
- package/pluginUtils/index.ts +4 -0
- package/reactHooks/advertising/index.ts +2 -2
- package/reactHooks/debugging/__tests__/index.test.js +4 -4
- package/reactHooks/device/useMemoizedIsTablet.ts +3 -3
- package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +3 -0
- package/reactHooks/feed/useEntryScreenId.ts +2 -2
- package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +13 -16
- package/reactHooks/layout/useDimensions/__tests__/{useDimensions.test.ts → useDimensions.test.tsx} +105 -25
- package/reactHooks/layout/useDimensions/useDimensions.ts +2 -2
- package/reactHooks/navigation/index.ts +7 -6
- package/reactHooks/navigation/useRoute.ts +8 -6
- package/reactHooks/resolvers/useCellResolver.ts +6 -2
- package/reactHooks/resolvers/useComponentResolver.ts +8 -2
- package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +10 -2
- package/reactHooks/screen/useTargetScreenData.ts +4 -2
- package/reactHooks/state/useRivers.ts +1 -1
- package/reactHooks/usePluginConfiguration.ts +2 -2
- package/testUtils/index.tsx +29 -20
- package/utils/__tests__/selectors.test.ts +124 -0
- package/utils/index.ts +3 -0
- package/utils/selectors.ts +46 -0
- package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +15 -6
|
@@ -5,6 +5,7 @@ import { createLogger, utilsLogger } from "../../../logger";
|
|
|
5
5
|
import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
|
|
6
6
|
import {
|
|
7
7
|
findPluginByIdentifier,
|
|
8
|
+
loadFeedEntry,
|
|
8
9
|
loadFeedAndPrefetchThumbnailImage,
|
|
9
10
|
parseTimeToSeconds,
|
|
10
11
|
retrieveFeedUrl,
|
|
@@ -26,6 +27,19 @@ type ChapterMarkerOriginal = {
|
|
|
26
27
|
actions: ActionChapter[];
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
export type LiveMetadataEvent = {
|
|
31
|
+
programId: string;
|
|
32
|
+
assetId: string;
|
|
33
|
+
title: string;
|
|
34
|
+
programStartTime: string;
|
|
35
|
+
programEndTime: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type LiveMetadataConfig = {
|
|
39
|
+
updateUrl: string;
|
|
40
|
+
updateInterval: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
29
43
|
export type TitleSummaryEvent = {
|
|
30
44
|
title: string | number;
|
|
31
45
|
summary: string | number;
|
|
@@ -50,11 +64,13 @@ export type PlayNextState = PlayNextConfig & {
|
|
|
50
64
|
export class OverlaysObserver {
|
|
51
65
|
readonly chapterSubject: BehaviorSubject<ChapterMarkerEvent>;
|
|
52
66
|
private playNextSubject: BehaviorSubject<PlayNextState>;
|
|
67
|
+
private liveMetadataSubject: BehaviorSubject<LiveMetadataEvent>;
|
|
53
68
|
private titleSummarySubject: BehaviorSubject<TitleSummaryEvent>;
|
|
54
69
|
private feedUrl: string;
|
|
55
70
|
private reloadData: () => void;
|
|
56
71
|
private updateTitleAndDescription: (data: any) => void;
|
|
57
72
|
private feedDataInterval: any;
|
|
73
|
+
private liveMetadataUpdateInterval: any;
|
|
58
74
|
private releasePlayerObserver?: () => void;
|
|
59
75
|
readonly entry: ZappEntry;
|
|
60
76
|
private chapterMarkerEvents: ChapterMarkerEvent[];
|
|
@@ -66,13 +82,17 @@ export class OverlaysObserver {
|
|
|
66
82
|
this.chapterSubject = new BehaviorSubject(null);
|
|
67
83
|
this.playNextSubject = new BehaviorSubject(null);
|
|
68
84
|
|
|
85
|
+
this.player = player;
|
|
86
|
+
this.entry = player.getEntry();
|
|
87
|
+
|
|
69
88
|
this.titleSummarySubject = new BehaviorSubject<TitleSummaryEvent>({
|
|
70
|
-
title:
|
|
71
|
-
summary:
|
|
89
|
+
title: this.entry?.title || "",
|
|
90
|
+
summary: this.entry?.summary || "",
|
|
72
91
|
});
|
|
73
92
|
|
|
74
|
-
this.
|
|
75
|
-
|
|
93
|
+
this.liveMetadataSubject = new BehaviorSubject<LiveMetadataEvent>(
|
|
94
|
+
this.entry?.extensions?.liveMetadata || null
|
|
95
|
+
);
|
|
76
96
|
|
|
77
97
|
this.chapterMarkerEvents = this.prepareChapterMarkers();
|
|
78
98
|
this.releasePlayerObserver = this.subscribeToPlayerEvents();
|
|
@@ -80,7 +100,9 @@ export class OverlaysObserver {
|
|
|
80
100
|
this.reloadData = () => {};
|
|
81
101
|
this.updateTitleAndDescription = () => {};
|
|
82
102
|
this.feedDataInterval = null;
|
|
103
|
+
this.liveMetadataUpdateInterval = null;
|
|
83
104
|
void this.preparePlayNext();
|
|
105
|
+
void this.prepareLiveMetadata();
|
|
84
106
|
}
|
|
85
107
|
|
|
86
108
|
private setupFeedDataInterval(interval: number) {
|
|
@@ -98,6 +120,13 @@ export class OverlaysObserver {
|
|
|
98
120
|
}
|
|
99
121
|
}
|
|
100
122
|
|
|
123
|
+
public clearLiveMetadataUpdateInterval() {
|
|
124
|
+
if (this.liveMetadataUpdateInterval) {
|
|
125
|
+
clearInterval(this.liveMetadataUpdateInterval);
|
|
126
|
+
this.liveMetadataUpdateInterval = null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
101
130
|
public setFeedDataHandlers(
|
|
102
131
|
feedUrl: string,
|
|
103
132
|
reloadData: () => void,
|
|
@@ -197,6 +226,48 @@ export class OverlaysObserver {
|
|
|
197
226
|
}
|
|
198
227
|
};
|
|
199
228
|
|
|
229
|
+
prepareLiveMetadata = async () => {
|
|
230
|
+
if (!this.player?.isLive?.()) {
|
|
231
|
+
log_debug("prepareLiveMetadata: Player is not live. Skipping...");
|
|
232
|
+
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const config: LiveMetadataConfig =
|
|
237
|
+
this.entry?.extensions?.liveMetadataConfig;
|
|
238
|
+
|
|
239
|
+
if (!config?.updateUrl || !config?.updateInterval) {
|
|
240
|
+
log_debug(
|
|
241
|
+
"prepareLiveMetadata: Live metadata configuration is not available. Skipping...",
|
|
242
|
+
{ config }
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const reloadData = async () => {
|
|
249
|
+
try {
|
|
250
|
+
const entry = await loadFeedEntry(config.updateUrl, this.entry);
|
|
251
|
+
|
|
252
|
+
this.onLiveMetadataUpdated(entry?.extensions?.liveMetadata || null);
|
|
253
|
+
} catch (error) {
|
|
254
|
+
log_error("prepareLiveMetadata: Metadata fetching failed", {
|
|
255
|
+
error,
|
|
256
|
+
config,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
log_debug("prepareLiveMetadata: Setting up live metadata observer update", {
|
|
262
|
+
config,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
const interval = Number(config?.updateInterval) || 60;
|
|
266
|
+
|
|
267
|
+
this.clearLiveMetadataUpdateInterval();
|
|
268
|
+
this.liveMetadataUpdateInterval = setInterval(reloadData, interval * 1000);
|
|
269
|
+
};
|
|
270
|
+
|
|
200
271
|
// TODO: Hack for video end, will be replaced with playlist prev/next in the future
|
|
201
272
|
getPlayNextEntry = () =>
|
|
202
273
|
!this.isCanceledByUser ? this.playNextConfig?.entry : null;
|
|
@@ -317,9 +388,11 @@ export class OverlaysObserver {
|
|
|
317
388
|
onPlayerClose = () => {
|
|
318
389
|
this.chapterSubject.complete();
|
|
319
390
|
this.playNextSubject.complete();
|
|
391
|
+
this.liveMetadataSubject.complete();
|
|
320
392
|
this.titleSummarySubject.complete();
|
|
321
393
|
this.releasePlayerObserver?.();
|
|
322
394
|
this.clearFeedDataInterval();
|
|
395
|
+
this.clearLiveMetadataUpdateInterval();
|
|
323
396
|
this.releasePlayerObserver = null;
|
|
324
397
|
};
|
|
325
398
|
|
|
@@ -352,4 +425,21 @@ export class OverlaysObserver {
|
|
|
352
425
|
(prev, curr) => prev?.triggerTime === curr?.triggerTime
|
|
353
426
|
)
|
|
354
427
|
);
|
|
428
|
+
|
|
429
|
+
private onLiveMetadataUpdated = (liveMetadataEvent: LiveMetadataEvent) => {
|
|
430
|
+
this.liveMetadataSubject.next(liveMetadataEvent);
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
public getLiveMetadataObservable = (): Observable<LiveMetadataEvent> => {
|
|
434
|
+
return this.liveMetadataSubject.pipe(
|
|
435
|
+
distinctUntilChanged(
|
|
436
|
+
(prev, curr) =>
|
|
437
|
+
prev?.programId === curr?.programId && prev?.assetId === curr?.assetId
|
|
438
|
+
)
|
|
439
|
+
);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
public getLiveMetadataValue = (): LiveMetadataEvent => {
|
|
443
|
+
return this.liveMetadataSubject.value;
|
|
444
|
+
};
|
|
355
445
|
}
|
|
@@ -92,22 +92,26 @@ export const prefetchImage = (playableItem: ZappEntry, config: any = {}) => {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Loads a feed entry from the given feed URL using the provided Zapp entry as context.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} feedUrl - The URL of the feed to load the entry from.
|
|
99
|
+
* @param {ZappEntry} entry - The Zapp entry to use as context for the request.
|
|
100
|
+
* @returns {Promise<ZappEntry>} A promise that resolves to the loaded Zapp entry.
|
|
101
|
+
* @throws {Error} If the feed loading fails or no entry is found in the response.
|
|
102
|
+
*/
|
|
103
|
+
export const loadFeedEntry = async (feedUrl: string, entry: ZappEntry) => {
|
|
100
104
|
const requestBuilder = new RequestBuilder()
|
|
101
105
|
.setEntryContext(entry)
|
|
102
106
|
.setScreenContext({} as ZappRiver)
|
|
103
|
-
.setUrl(
|
|
107
|
+
.setUrl(feedUrl);
|
|
104
108
|
|
|
105
109
|
const responseObject = await requestBuilder.call<ZappEntry>();
|
|
106
110
|
const responseHelper = new PipesClientResponseHelper(responseObject);
|
|
107
111
|
|
|
108
112
|
if (responseHelper.error) {
|
|
109
113
|
log_error(
|
|
110
|
-
`
|
|
114
|
+
`loadFeedEntry: loading failed with error: ${responseHelper.error.message}. Observer will not be executed`,
|
|
111
115
|
{
|
|
112
116
|
response: responseHelper.getLogsData(),
|
|
113
117
|
}
|
|
@@ -116,29 +120,37 @@ export const loadFeedAndPrefetchThumbnailImage = async (
|
|
|
116
120
|
throw responseHelper.error;
|
|
117
121
|
} else {
|
|
118
122
|
log_info(
|
|
119
|
-
`
|
|
123
|
+
`loadFeedEntry: Feed was successfully loaded for url: ${feedUrl}`,
|
|
120
124
|
responseHelper.getLogsData()
|
|
121
125
|
);
|
|
122
126
|
|
|
123
|
-
const
|
|
127
|
+
const entry = responseHelper.responseData?.entry[0];
|
|
124
128
|
|
|
125
|
-
if (!
|
|
126
|
-
|
|
127
|
-
"
|
|
128
|
-
responseHelper.getLogsData()
|
|
129
|
-
);
|
|
129
|
+
if (!entry) {
|
|
130
|
+
const error =
|
|
131
|
+
"loadFeedEntry: Can not retrieve entry, feed was loaded but no entry was found";
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
"Can not retrieve play next entry, feed was loaded but no entry was found"
|
|
133
|
-
);
|
|
134
|
-
}
|
|
133
|
+
log_error(error, responseHelper.getLogsData());
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
throw new Error(error);
|
|
136
|
+
}
|
|
137
137
|
|
|
138
|
-
return
|
|
138
|
+
return entry;
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
+
export const loadFeedAndPrefetchThumbnailImage = async (
|
|
143
|
+
playNextFeedUrl: string,
|
|
144
|
+
entry: ZappEntry,
|
|
145
|
+
playNextPlugin
|
|
146
|
+
) => {
|
|
147
|
+
const playNextEntry = await loadFeedEntry(playNextFeedUrl, entry);
|
|
148
|
+
|
|
149
|
+
prefetchImage(playNextEntry, playNextPlugin?.configuration);
|
|
150
|
+
|
|
151
|
+
return playNextEntry;
|
|
152
|
+
};
|
|
153
|
+
|
|
142
154
|
export const findPluginByIdentifier = (
|
|
143
155
|
identifier: string,
|
|
144
156
|
plugins: ZappPlugin[]
|
|
@@ -15,6 +15,22 @@ const logger = createLogger({
|
|
|
15
15
|
|
|
16
16
|
const { log_warning } = logger;
|
|
17
17
|
|
|
18
|
+
interface PlayerMethods {
|
|
19
|
+
seeking?: (position: number) => void;
|
|
20
|
+
forward?: (deltaTime: number) => void;
|
|
21
|
+
rewind?: (deltaTime: number) => void;
|
|
22
|
+
startSleepTimer?: (sleepTimestamp: number) => void;
|
|
23
|
+
selectTrack?: (
|
|
24
|
+
selected: QuickBrickPlayer.TextTrack | QuickBrickPlayer.AudioTrack
|
|
25
|
+
) => void;
|
|
26
|
+
setPlaybackRate?: (rate: number) => void;
|
|
27
|
+
appStateChange?: (appState: string, previousAppState: string) => void;
|
|
28
|
+
closeNativePlayer?: () => void;
|
|
29
|
+
togglePlayPause?: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type PlayerComponent = ReactComponent<PlayerRefProps> & PlayerMethods;
|
|
33
|
+
|
|
18
34
|
type PlayerPlugnId = "QuickBrickPlayerPlugin" | "KalturaPlayerPlugin";
|
|
19
35
|
|
|
20
36
|
type Props = {
|
|
@@ -62,7 +78,7 @@ export class PlayerNative extends Player {
|
|
|
62
78
|
return this.playerState.contentPosition;
|
|
63
79
|
};
|
|
64
80
|
|
|
65
|
-
currentPlayerComponent = ():
|
|
81
|
+
currentPlayerComponent = (): PlayerComponent | null =>
|
|
66
82
|
this.playerComponent?.current;
|
|
67
83
|
|
|
68
84
|
getState = () => this.playerState;
|
|
@@ -121,7 +137,7 @@ export class PlayerNative extends Player {
|
|
|
121
137
|
|
|
122
138
|
this.playerState.seekPosition = newPosition;
|
|
123
139
|
|
|
124
|
-
this.currentPlayerComponent()?.
|
|
140
|
+
this.currentPlayerComponent()?.seeking?.(this.playerState.seekPosition);
|
|
125
141
|
}
|
|
126
142
|
|
|
127
143
|
this.logState(PlayerModuleFuncNames.seekTo, { position });
|
|
@@ -135,7 +151,7 @@ export class PlayerNative extends Player {
|
|
|
135
151
|
if (!this.invokeNativeFunction(PlayerModuleFuncNames.forward, deltaTime)) {
|
|
136
152
|
// Kaltura does not have yet this implementation, use legacy code
|
|
137
153
|
|
|
138
|
-
this.currentPlayerComponent()?.
|
|
154
|
+
this.currentPlayerComponent()?.forward?.(deltaTime);
|
|
139
155
|
}
|
|
140
156
|
|
|
141
157
|
this.notifyPlayHeadPositionUpdate();
|
|
@@ -151,7 +167,7 @@ export class PlayerNative extends Player {
|
|
|
151
167
|
if (!this.invokeNativeFunction(PlayerModuleFuncNames.rewind, deltaTime)) {
|
|
152
168
|
// Kaltura does not have yet this implementation, use legacy code
|
|
153
169
|
|
|
154
|
-
this.currentPlayerComponent()?.
|
|
170
|
+
this.currentPlayerComponent()?.rewind?.(deltaTime);
|
|
155
171
|
}
|
|
156
172
|
|
|
157
173
|
this.notifyPlayHeadPositionUpdate();
|
|
@@ -178,7 +194,7 @@ export class PlayerNative extends Player {
|
|
|
178
194
|
sleepTimestamp
|
|
179
195
|
)
|
|
180
196
|
) {
|
|
181
|
-
this.currentPlayerComponent()?.
|
|
197
|
+
this.currentPlayerComponent()?.startSleepTimer?.(sleepTimestamp);
|
|
182
198
|
}
|
|
183
199
|
};
|
|
184
200
|
|
|
@@ -195,11 +211,11 @@ export class PlayerNative extends Player {
|
|
|
195
211
|
selectTrack = (
|
|
196
212
|
selected: QuickBrickPlayer.TextTrack | QuickBrickPlayer.AudioTrack
|
|
197
213
|
) => {
|
|
198
|
-
this.currentPlayerComponent()?.
|
|
214
|
+
this.currentPlayerComponent()?.selectTrack?.(selected);
|
|
199
215
|
};
|
|
200
216
|
|
|
201
217
|
setPlaybackRate = (rate: number) => {
|
|
202
|
-
this.currentPlayerComponent()?.
|
|
218
|
+
this.currentPlayerComponent()?.setPlaybackRate?.(rate);
|
|
203
219
|
};
|
|
204
220
|
|
|
205
221
|
getPluginConfiguration = () => {
|
|
@@ -209,19 +225,16 @@ export class PlayerNative extends Player {
|
|
|
209
225
|
getProps = () => (this.currentPlayerComponent() as any)?.props;
|
|
210
226
|
|
|
211
227
|
appStateChange = (appState, previousAppState) => {
|
|
212
|
-
this.currentPlayerComponent()?.
|
|
213
|
-
appState,
|
|
214
|
-
previousAppState
|
|
215
|
-
);
|
|
228
|
+
this.currentPlayerComponent()?.appStateChange?.(appState, previousAppState);
|
|
216
229
|
};
|
|
217
230
|
|
|
218
231
|
closeNativePlayer = () => {
|
|
219
232
|
// TODO: Delete does not work
|
|
220
|
-
this.currentPlayerComponent()?.
|
|
233
|
+
this.currentPlayerComponent()?.closeNativePlayer?.();
|
|
221
234
|
};
|
|
222
235
|
|
|
223
236
|
togglePlayPause = () => {
|
|
224
|
-
this.currentPlayerComponent()?.
|
|
237
|
+
this.currentPlayerComponent()?.togglePlayPause?.();
|
|
225
238
|
};
|
|
226
239
|
|
|
227
240
|
onVideoLoad = (event) => {
|
|
@@ -289,19 +302,19 @@ export class PlayerNative extends Player {
|
|
|
289
302
|
isFullScreenSupported = (): boolean => {
|
|
290
303
|
const config = this.getConfig();
|
|
291
304
|
|
|
292
|
-
const disableFullScreen = config?.
|
|
305
|
+
const disableFullScreen = config?.disable_fullscreen;
|
|
293
306
|
|
|
294
307
|
if (disableFullScreen) {
|
|
295
308
|
return false;
|
|
296
309
|
}
|
|
297
310
|
|
|
298
|
-
const isFullScreenAudioPlayer = config?.
|
|
311
|
+
const isFullScreenAudioPlayer = config?.full_screen_audio_player;
|
|
299
312
|
|
|
300
313
|
return !(isFullScreenAudioPlayer && this.isAudioItem());
|
|
301
314
|
};
|
|
302
315
|
|
|
303
316
|
supportsNativeControls = (): boolean =>
|
|
304
|
-
toBooleanWithDefaultFalse(this.getConfig()?.
|
|
317
|
+
toBooleanWithDefaultFalse(this.getConfig()?.supports_native_controls);
|
|
305
318
|
|
|
306
319
|
supportNativeCast = (): boolean =>
|
|
307
320
|
toBooleanWithDefaultFalse(
|
package/cellUtils/index.ts
CHANGED
|
@@ -505,3 +505,35 @@ export const getImageContainerMarginStyles = ({ value }: { value: any }) => {
|
|
|
505
505
|
marginRight: value("image_margin_right"),
|
|
506
506
|
};
|
|
507
507
|
};
|
|
508
|
+
|
|
509
|
+
export const isTextLabel = (key: string): boolean =>
|
|
510
|
+
key.includes("text_label_") && key.endsWith("_switch");
|
|
511
|
+
|
|
512
|
+
export const hasTextLabelsEnabled = (
|
|
513
|
+
configuration: Record<string, any>
|
|
514
|
+
): boolean => {
|
|
515
|
+
const textLabelsKeys = Object.keys(configuration).filter(isTextLabel);
|
|
516
|
+
|
|
517
|
+
const picked = textLabelsKeys.reduce(
|
|
518
|
+
(acc, key) => {
|
|
519
|
+
acc[key] = configuration[key];
|
|
520
|
+
|
|
521
|
+
return acc;
|
|
522
|
+
},
|
|
523
|
+
{} as Record<string, any>
|
|
524
|
+
);
|
|
525
|
+
|
|
526
|
+
const pickedValues = Object.values(picked);
|
|
527
|
+
|
|
528
|
+
return pickedValues.some((value) => {
|
|
529
|
+
if (typeof value === "boolean") {
|
|
530
|
+
return value === true;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (typeof value === "string") {
|
|
534
|
+
return value !== "" && value.toLowerCase() !== "false";
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return Boolean(value);
|
|
538
|
+
});
|
|
539
|
+
};
|
|
@@ -50,7 +50,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
expect(outStyles).toHaveProperty("default");
|
|
53
|
-
expect(outStyles
|
|
53
|
+
expect(outStyles.default).toEqual({});
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
it("should handle empty configuration", () => {
|
|
@@ -83,7 +83,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
83
83
|
outStyles,
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
expect(outStyles
|
|
86
|
+
expect(outStyles.default).toEqual({
|
|
87
87
|
backgroundColor: "#FF0000",
|
|
88
88
|
borderWidth: 2,
|
|
89
89
|
});
|
|
@@ -104,7 +104,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
104
104
|
outStyles,
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
expect(outStyles
|
|
107
|
+
expect(outStyles.default).toEqual({
|
|
108
108
|
backgroundColor: "#FF0000",
|
|
109
109
|
textSize: 16,
|
|
110
110
|
});
|
|
@@ -126,7 +126,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
126
126
|
outStyles,
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
expect(outStyles
|
|
129
|
+
expect(outStyles.default).toEqual({
|
|
130
130
|
backgroundColor: "#FF0000",
|
|
131
131
|
});
|
|
132
132
|
});
|
|
@@ -148,11 +148,11 @@ describe("getAllSpecificStyles", () => {
|
|
|
148
148
|
outStyles,
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
-
expect(outStyles
|
|
151
|
+
expect(outStyles.default).toEqual({
|
|
152
152
|
backgroundColor: "#FF0000",
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
-
expect(outStyles
|
|
155
|
+
expect(outStyles.pressed).toEqual({
|
|
156
156
|
backgroundColor: "#00FF00",
|
|
157
157
|
});
|
|
158
158
|
});
|
|
@@ -171,7 +171,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
171
171
|
outStyles,
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
-
expect(outStyles
|
|
174
|
+
expect(outStyles.focused).toEqual({
|
|
175
175
|
borderWidth: 3,
|
|
176
176
|
});
|
|
177
177
|
});
|
|
@@ -190,7 +190,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
190
190
|
outStyles,
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
-
expect(outStyles
|
|
193
|
+
expect(outStyles.selected).toEqual({
|
|
194
194
|
opacity: 0.5,
|
|
195
195
|
});
|
|
196
196
|
});
|
|
@@ -209,7 +209,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
209
209
|
outStyles,
|
|
210
210
|
});
|
|
211
211
|
|
|
212
|
-
expect(outStyles
|
|
212
|
+
expect(outStyles.focused_selected).toEqual({
|
|
213
213
|
scale: 1.2,
|
|
214
214
|
});
|
|
215
215
|
});
|
|
@@ -232,21 +232,21 @@ describe("getAllSpecificStyles", () => {
|
|
|
232
232
|
outStyles,
|
|
233
233
|
});
|
|
234
234
|
|
|
235
|
-
expect(outStyles
|
|
235
|
+
expect(outStyles.default).toEqual({
|
|
236
236
|
backgroundColor: "#FF0000",
|
|
237
237
|
borderWidth: 1,
|
|
238
238
|
opacity: 1,
|
|
239
239
|
});
|
|
240
240
|
|
|
241
241
|
// Pressed should have default styles merged with its specific override
|
|
242
|
-
expect(outStyles
|
|
242
|
+
expect(outStyles.pressed).toEqual({
|
|
243
243
|
backgroundColor: "#00FF00", // Override
|
|
244
244
|
borderWidth: 1, // From default
|
|
245
245
|
opacity: 1, // From default
|
|
246
246
|
});
|
|
247
247
|
|
|
248
248
|
// Focused should have default styles merged with its specific override
|
|
249
|
-
expect(outStyles
|
|
249
|
+
expect(outStyles.focused).toEqual({
|
|
250
250
|
backgroundColor: "#FF0000", // From default
|
|
251
251
|
borderWidth: 1, // From default
|
|
252
252
|
opacity: 0.8, // Override
|
|
@@ -270,7 +270,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
270
270
|
outStyles,
|
|
271
271
|
});
|
|
272
272
|
|
|
273
|
-
expect(outStyles
|
|
273
|
+
expect(outStyles.pressed).toEqual({
|
|
274
274
|
existingKey: "existingValue", // Should be preserved
|
|
275
275
|
backgroundColor: "#FF0000", // From default
|
|
276
276
|
textColor: "#FFFFFF", // New pressed style
|
|
@@ -294,7 +294,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
294
294
|
outStyles,
|
|
295
295
|
});
|
|
296
296
|
|
|
297
|
-
expect(outStyles
|
|
297
|
+
expect(outStyles.default).toEqual({
|
|
298
298
|
backgroundColor: "#FF0000", // Samsung-specific should be included
|
|
299
299
|
});
|
|
300
300
|
});
|
|
@@ -317,7 +317,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
317
317
|
outStyles,
|
|
318
318
|
});
|
|
319
319
|
|
|
320
|
-
expect(outStyles
|
|
320
|
+
expect(outStyles.default).toEqual({
|
|
321
321
|
backgroundColor: "#FFFFFF", // Only non-platform specific
|
|
322
322
|
});
|
|
323
323
|
});
|
|
@@ -336,7 +336,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
336
336
|
outStyles,
|
|
337
337
|
});
|
|
338
338
|
|
|
339
|
-
expect(outStyles
|
|
339
|
+
expect(outStyles.default).toEqual({
|
|
340
340
|
color: "#FF0000",
|
|
341
341
|
});
|
|
342
342
|
});
|
|
@@ -356,7 +356,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
356
356
|
outStyles,
|
|
357
357
|
});
|
|
358
358
|
|
|
359
|
-
expect(outStyles
|
|
359
|
+
expect(outStyles.pressed).toEqual({
|
|
360
360
|
backgroundColor: "#FF0000", // Only samsung style
|
|
361
361
|
});
|
|
362
362
|
});
|
|
@@ -377,7 +377,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
377
377
|
outStyles,
|
|
378
378
|
});
|
|
379
379
|
|
|
380
|
-
expect(outStyles
|
|
380
|
+
expect(outStyles.default).toEqual({
|
|
381
381
|
backgroundColor: "#00FF00", // Samsung-specific should win
|
|
382
382
|
});
|
|
383
383
|
});
|
|
@@ -412,14 +412,14 @@ describe("getAllSpecificStyles", () => {
|
|
|
412
412
|
outStyles,
|
|
413
413
|
});
|
|
414
414
|
|
|
415
|
-
expect(outStyles
|
|
415
|
+
expect(outStyles.default).toEqual({
|
|
416
416
|
backgroundColor: "#FFFFFF",
|
|
417
417
|
textColor: "#000000",
|
|
418
418
|
borderWidth: 1,
|
|
419
419
|
padding: 10,
|
|
420
420
|
});
|
|
421
421
|
|
|
422
|
-
expect(outStyles
|
|
422
|
+
expect(outStyles.pressed).toEqual({
|
|
423
423
|
backgroundColor: "#EEEEEE",
|
|
424
424
|
textColor: "#000000",
|
|
425
425
|
borderWidth: 1,
|
|
@@ -427,7 +427,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
427
427
|
opacity: 0.8,
|
|
428
428
|
});
|
|
429
429
|
|
|
430
|
-
expect(outStyles
|
|
430
|
+
expect(outStyles.focused).toEqual({
|
|
431
431
|
backgroundColor: "#FFFFFF",
|
|
432
432
|
textColor: "#000000",
|
|
433
433
|
borderWidth: 1,
|
|
@@ -453,7 +453,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
453
453
|
outStyles,
|
|
454
454
|
});
|
|
455
455
|
|
|
456
|
-
expect(outStyles
|
|
456
|
+
expect(outStyles.default).toEqual({
|
|
457
457
|
validKey: "included",
|
|
458
458
|
});
|
|
459
459
|
});
|
|
@@ -474,11 +474,11 @@ describe("getAllSpecificStyles", () => {
|
|
|
474
474
|
outStyles,
|
|
475
475
|
});
|
|
476
476
|
|
|
477
|
-
expect(outStyles
|
|
477
|
+
expect(outStyles.focused_selected).toEqual({
|
|
478
478
|
test: "focused_selected_value",
|
|
479
479
|
});
|
|
480
480
|
|
|
481
|
-
expect(outStyles
|
|
481
|
+
expect(outStyles.focused).toEqual({
|
|
482
482
|
another: "focused_value",
|
|
483
483
|
});
|
|
484
484
|
});
|
|
@@ -517,7 +517,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
517
517
|
outStyles,
|
|
518
518
|
});
|
|
519
519
|
|
|
520
|
-
expect(outStyles
|
|
520
|
+
expect(outStyles.pressed.backgroundColor).toBe("#222222");
|
|
521
521
|
});
|
|
522
522
|
|
|
523
523
|
it("should handle frozen outStyles properties", () => {
|
|
@@ -537,7 +537,7 @@ describe("getAllSpecificStyles", () => {
|
|
|
537
537
|
});
|
|
538
538
|
|
|
539
539
|
// Should create new object instead of mutating frozen one
|
|
540
|
-
expect(outStyles
|
|
540
|
+
expect(outStyles.default).toEqual({
|
|
541
541
|
existingProp: "value",
|
|
542
542
|
backgroundColor: "#FF0000",
|
|
543
543
|
});
|
|
@@ -342,6 +342,13 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
342
342
|
type: "text_input",
|
|
343
343
|
});
|
|
344
344
|
|
|
345
|
+
localizations.fields.push({
|
|
346
|
+
key: "start_over_label",
|
|
347
|
+
label: "Start over label",
|
|
348
|
+
initial_value: "Start Over",
|
|
349
|
+
type: "text_input",
|
|
350
|
+
});
|
|
351
|
+
|
|
345
352
|
styles.fields.push(
|
|
346
353
|
fieldsGroup("Always Show Scrub Bar & Timestamp", "", [
|
|
347
354
|
{
|
|
@@ -647,13 +654,25 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
647
654
|
initial_value: 300,
|
|
648
655
|
type: "number_input",
|
|
649
656
|
label_tooltip:
|
|
650
|
-
"If duration less
|
|
657
|
+
"If duration less than this value, player will disable 'liveSeekingEnabled' value",
|
|
651
658
|
},
|
|
652
659
|
{
|
|
653
660
|
key: "live_image",
|
|
654
661
|
label: "Live badge",
|
|
655
662
|
type: "uploader",
|
|
656
663
|
label_tooltip: "Override default live badge / icon",
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
key: "live_width",
|
|
667
|
+
label: "Live badge width",
|
|
668
|
+
type: "number_input",
|
|
669
|
+
initial_value: 85,
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
key: "live_height",
|
|
673
|
+
label: "Live badge height",
|
|
674
|
+
type: "number_input",
|
|
675
|
+
initial_value: 50,
|
|
657
676
|
}
|
|
658
677
|
);
|
|
659
678
|
}
|
|
@@ -3468,6 +3487,22 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
3468
3487
|
label_tooltip:
|
|
3469
3488
|
"This field allows you to override the player configuration / initialization options. i.e. html5: { vhs: { limitRenditionByPlayerDimensions: false } } Please ensure your configuration matches the player you are targeting, and that it is a valid json. See config options here: https://videojs.com/guides/options/",
|
|
3470
3489
|
},
|
|
3490
|
+
{
|
|
3491
|
+
key: "advanced_player_styles",
|
|
3492
|
+
label: "Advanced Player Styles",
|
|
3493
|
+
type: "text_input",
|
|
3494
|
+
multiline: true,
|
|
3495
|
+
initial_value: `.vjs-text-track-cue {
|
|
3496
|
+
inset: unset !important;
|
|
3497
|
+
top: 94% !important;
|
|
3498
|
+
bottom: 0 !important;
|
|
3499
|
+
left: 0 !important;
|
|
3500
|
+
right: 0 !important;
|
|
3501
|
+
width: 100% !important;
|
|
3502
|
+
}`,
|
|
3503
|
+
label_tooltip:
|
|
3504
|
+
"This field allows you to inject custom CSS styles to override default player styles. The styles will be injected into the document head and can be used to customize the appearance of the player. Leave empty to use only default styles.",
|
|
3505
|
+
},
|
|
3471
3506
|
{
|
|
3472
3507
|
key: "use_dashjs_player",
|
|
3473
3508
|
label: "Use Enhanced Player for DASH streams",
|