@applicaster/zapp-react-native-utils 15.0.0-alpha.2413435535 → 15.0.0-alpha.2535277107
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/appUtils/accessibilityManager/const.ts +4 -0
- package/appUtils/accessibilityManager/hooks.ts +21 -16
- package/appUtils/platform/platformUtils.ts +48 -33
- package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +94 -4
- package/appUtils/playerManager/OverlayObserver/utils.ts +32 -20
- package/appUtils/playerManager/player.ts +4 -0
- package/appUtils/playerManager/usePlayerState.tsx +14 -2
- package/cellUtils/index.ts +1 -8
- package/manifestUtils/defaultManifestConfigurations/player.js +52 -1
- package/manifestUtils/keys.js +21 -0
- package/manifestUtils/sharedConfiguration/screenPicker/utils.js +1 -0
- package/package.json +2 -2
- package/playerUtils/usePlayerTTS.ts +6 -4
- package/reactHooks/player/TVSeekControlller/TVSeekController.ts +27 -10
|
@@ -31,6 +31,10 @@ export const BUTTON_ACCESSIBILITY_KEYS = {
|
|
|
31
31
|
hint: "accessibility_close_mini_hint",
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
|
+
back_to_live: {
|
|
35
|
+
label: "back_to_live_label",
|
|
36
|
+
hint: "",
|
|
37
|
+
},
|
|
34
38
|
maximize: {
|
|
35
39
|
label: "accessibility_maximize_label",
|
|
36
40
|
hint: "accessibility_maximize_hint",
|
|
@@ -17,28 +17,13 @@ export const useAccessibilityManager = (
|
|
|
17
17
|
return AccessibilityManager.getInstance();
|
|
18
18
|
}, []);
|
|
19
19
|
|
|
20
|
-
const [accessibilityManagerState, setAccessibilityManagerState] =
|
|
21
|
-
useState<AccessibilityState>(accessibilityManager.getState());
|
|
22
|
-
|
|
23
20
|
useEffect(() => {
|
|
24
21
|
if (pluginConfiguration) {
|
|
25
22
|
accessibilityManager.updateLocalizations(pluginConfiguration);
|
|
26
23
|
}
|
|
27
24
|
}, [pluginConfiguration, accessibilityManager]);
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
const subscription = accessibilityManager.getStateAsObservable().subscribe({
|
|
31
|
-
next: (newState) => {
|
|
32
|
-
setAccessibilityManagerState(newState);
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return () => subscription.unsubscribe();
|
|
37
|
-
}, [accessibilityManager]);
|
|
38
|
-
|
|
39
|
-
return Object.assign(accessibilityManager, {
|
|
40
|
-
accessibilityManagerState,
|
|
41
|
-
});
|
|
26
|
+
return accessibilityManager;
|
|
42
27
|
};
|
|
43
28
|
|
|
44
29
|
export const useInitialAnnouncementReady = (
|
|
@@ -74,3 +59,23 @@ export const useAnnouncementActive = (
|
|
|
74
59
|
|
|
75
60
|
return isActive;
|
|
76
61
|
};
|
|
62
|
+
|
|
63
|
+
export const useAccessibilityState = (
|
|
64
|
+
pluginConfiguration: Record<string, any> = {}
|
|
65
|
+
) => {
|
|
66
|
+
const accessibilityManager = useAccessibilityManager(pluginConfiguration);
|
|
67
|
+
|
|
68
|
+
const [state, setState] = useState<AccessibilityState>(
|
|
69
|
+
accessibilityManager.getState()
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
const subscription = accessibilityManager
|
|
74
|
+
.getStateAsObservable()
|
|
75
|
+
.subscribe(setState);
|
|
76
|
+
|
|
77
|
+
return () => subscription.unsubscribe();
|
|
78
|
+
}, [accessibilityManager]);
|
|
79
|
+
|
|
80
|
+
return state;
|
|
81
|
+
};
|
|
@@ -234,34 +234,66 @@ export class TTSManager {
|
|
|
234
234
|
});
|
|
235
235
|
} catch (error) {
|
|
236
236
|
log_debug("webOS settings service request error", { error });
|
|
237
|
+
// Fallback to false if the service is not available
|
|
237
238
|
this.screenReaderEnabled$.next(false);
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
241
|
|
|
241
|
-
if (isSamsungPlatform() && typeof window.
|
|
242
|
+
if (isSamsungPlatform() && typeof window.webapis !== "undefined") {
|
|
242
243
|
try {
|
|
243
244
|
if (
|
|
244
|
-
window.
|
|
245
|
-
typeof window.
|
|
246
|
-
|
|
245
|
+
window.webapis?.tvinfo &&
|
|
246
|
+
typeof window.webapis.tvinfo.getMenuValue === "function" &&
|
|
247
|
+
typeof window.webapis.tvinfo.addCaptionChangeListener === "function"
|
|
247
248
|
) {
|
|
249
|
+
// Get initial Voice Guide status
|
|
250
|
+
const initialStatus = window.webapis.tvinfo.getMenuValue(
|
|
251
|
+
window.webapis.tvinfo.TvInfoMenuKey.VOICE_GUIDE_KEY
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
const isEnabled =
|
|
255
|
+
initialStatus === window.webapis.tvinfo.TvInfoMenuValue.ON;
|
|
256
|
+
|
|
257
|
+
log_debug("Samsung Voice Guide initial status", {
|
|
258
|
+
isEnabled,
|
|
259
|
+
initialStatus,
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
this.screenReaderEnabled$.next(isEnabled);
|
|
263
|
+
|
|
264
|
+
// Listen for Voice Guide status changes
|
|
265
|
+
const onChange = () => {
|
|
266
|
+
const currentStatus = window.webapis.tvinfo.getMenuValue(
|
|
267
|
+
window.webapis.tvinfo.TvInfoMenuKey.VOICE_GUIDE_KEY
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
const enabled =
|
|
271
|
+
currentStatus === window.webapis.tvinfo.TvInfoMenuValue.ON;
|
|
272
|
+
|
|
273
|
+
log_debug("Samsung Voice Guide status changed", {
|
|
274
|
+
enabled,
|
|
275
|
+
currentStatus,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
this.screenReaderEnabled$.next(enabled);
|
|
279
|
+
};
|
|
280
|
+
|
|
248
281
|
this.samsungListenerId =
|
|
249
|
-
window.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
this.screenReaderEnabled$.next(!!enabled);
|
|
253
|
-
}
|
|
282
|
+
window.webapis.tvinfo.addCaptionChangeListener(
|
|
283
|
+
window.webapis.tvinfo.TvInfoMenuKey.VOICE_GUIDE_KEY,
|
|
284
|
+
onChange
|
|
254
285
|
);
|
|
255
286
|
|
|
256
287
|
log_debug("Samsung Voice Guide listener registered", {
|
|
257
288
|
listenerId: this.samsungListenerId,
|
|
258
289
|
});
|
|
259
290
|
} else {
|
|
260
|
-
log_debug("Samsung
|
|
291
|
+
log_debug("Samsung TvInfo API not available");
|
|
261
292
|
this.screenReaderEnabled$.next(false);
|
|
262
293
|
}
|
|
263
294
|
} catch (error) {
|
|
264
295
|
log_debug("Samsung Voice Guide listener error", { error });
|
|
296
|
+
// Fallback to false if the service is not available
|
|
265
297
|
this.screenReaderEnabled$.next(false);
|
|
266
298
|
}
|
|
267
299
|
}
|
|
@@ -282,31 +314,14 @@ export class TTSManager {
|
|
|
282
314
|
readText(text: string) {
|
|
283
315
|
this.ttsState$.next(true);
|
|
284
316
|
|
|
285
|
-
if (
|
|
286
|
-
|
|
287
|
-
typeof window.tizen !== "undefined" &&
|
|
288
|
-
window.tizen.speech
|
|
289
|
-
) {
|
|
290
|
-
try {
|
|
291
|
-
const successCallback = () => {
|
|
292
|
-
log_debug("Samsung TTS play started successfully");
|
|
293
|
-
// Estimate reading time and set inactive when done
|
|
294
|
-
this.scheduleTTSComplete(text);
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
const errorCallback = (error: any) => {
|
|
298
|
-
log_debug("Samsung TTS error", { error: error?.message || error });
|
|
299
|
-
this.ttsState$.next(false);
|
|
300
|
-
};
|
|
317
|
+
if (isSamsungPlatform() && window.speechSynthesis) {
|
|
318
|
+
const utterance = new SpeechSynthesisUtterance(text);
|
|
301
319
|
|
|
302
|
-
|
|
303
|
-
|
|
320
|
+
window.speechSynthesis.cancel(); // Cancel previous speech before speaking new text
|
|
321
|
+
window.speechSynthesis.speak(utterance);
|
|
304
322
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
log_debug("Samsung TTS speak() error", { error });
|
|
308
|
-
this.ttsState$.next(false);
|
|
309
|
-
}
|
|
323
|
+
// Estimate reading time and set inactive when done
|
|
324
|
+
this.scheduleTTSComplete(text);
|
|
310
325
|
}
|
|
311
326
|
|
|
312
327
|
if (isLgPlatform() && window.webOS?.service) {
|
|
@@ -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[]
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { Player } from "./player";
|
|
3
3
|
import { usePlayer } from "./usePlayer";
|
|
4
4
|
|
|
5
|
-
type PlayerState = {
|
|
5
|
+
export type PlayerState = {
|
|
6
6
|
currentTime: number;
|
|
7
7
|
duration: number;
|
|
8
8
|
seekableDuration: number;
|
|
@@ -10,6 +10,8 @@ type PlayerState = {
|
|
|
10
10
|
isPaused: boolean;
|
|
11
11
|
isBuffering: boolean;
|
|
12
12
|
isReadyToPlay: boolean;
|
|
13
|
+
trackState?: QuickBrickPlayer.TracksState;
|
|
14
|
+
isAd: boolean;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export const usePlayerState = (
|
|
@@ -24,6 +26,8 @@ export const usePlayerState = (
|
|
|
24
26
|
isPaused: null,
|
|
25
27
|
isBuffering: false,
|
|
26
28
|
isReadyToPlay: false,
|
|
29
|
+
trackState: null,
|
|
30
|
+
isAd: false,
|
|
27
31
|
});
|
|
28
32
|
|
|
29
33
|
const player: Player = usePlayer(playerId);
|
|
@@ -37,6 +41,8 @@ export const usePlayerState = (
|
|
|
37
41
|
isPaused: player.isPaused(),
|
|
38
42
|
isBuffering: player.isBuffering(),
|
|
39
43
|
isReadyToPlay: player.isReadyToPlay(),
|
|
44
|
+
trackState: player.getTracksState(),
|
|
45
|
+
isAd: player.isAd(),
|
|
40
46
|
});
|
|
41
47
|
}, [player]);
|
|
42
48
|
|
|
@@ -54,10 +60,16 @@ export const usePlayerState = (
|
|
|
54
60
|
onPlayerPause: onPlayerChangeState,
|
|
55
61
|
onPlayerResume: onPlayerChangeState,
|
|
56
62
|
onPlayerSeekComplete: onPlayerChangeState,
|
|
63
|
+
onTracksChanged: onPlayerChangeState,
|
|
64
|
+
onAdBreakBegin: onPlayerChangeState,
|
|
65
|
+
onAdBreakEnd: onPlayerChangeState,
|
|
66
|
+
onAdBegin: onPlayerChangeState,
|
|
67
|
+
onAdEnd: onPlayerChangeState,
|
|
68
|
+
onAdError: onPlayerChangeState,
|
|
57
69
|
},
|
|
58
70
|
});
|
|
59
71
|
}
|
|
60
|
-
}, [player]);
|
|
72
|
+
}, [listenerId, onPlayerChangeState, player]);
|
|
61
73
|
|
|
62
74
|
return state;
|
|
63
75
|
};
|
package/cellUtils/index.ts
CHANGED
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
} from "@applicaster/zapp-react-native-utils/stringUtils";
|
|
10
10
|
import { cellUtilsLogger } from "@applicaster/zapp-react-native-utils/cellUtils/logger";
|
|
11
11
|
import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
12
|
-
import {
|
|
13
|
-
isNotNil,
|
|
14
|
-
isNilOrEmpty,
|
|
15
|
-
} from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
12
|
+
import { isNotNil } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
16
13
|
|
|
17
14
|
import { toNumberWithDefault, toNumberWithDefaultZero } from "../numberUtils";
|
|
18
15
|
|
|
@@ -509,9 +506,6 @@ export const getImageContainerMarginStyles = ({ value }: { value: any }) => {
|
|
|
509
506
|
};
|
|
510
507
|
};
|
|
511
508
|
|
|
512
|
-
export const withoutNilOrEmpty = (arr: string[]): string[] =>
|
|
513
|
-
arr.filter((item) => !isNilOrEmpty(item));
|
|
514
|
-
|
|
515
509
|
export const isTextLabel = (key: string): boolean =>
|
|
516
510
|
key.includes("text_label_") && key.endsWith("_switch");
|
|
517
511
|
|
|
@@ -531,7 +525,6 @@ export const hasTextLabelsEnabled = (
|
|
|
531
525
|
|
|
532
526
|
const pickedValues = Object.values(picked);
|
|
533
527
|
|
|
534
|
-
// Check if any switch value is truthy (true, "true", "1", etc.)
|
|
535
528
|
return pickedValues.some((value) => {
|
|
536
529
|
if (typeof value === "boolean") {
|
|
537
530
|
return value === true;
|
|
@@ -335,6 +335,13 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
335
335
|
};
|
|
336
336
|
|
|
337
337
|
if (isTV(platform)) {
|
|
338
|
+
localizations.fields.push({
|
|
339
|
+
key: "back_to_live_label",
|
|
340
|
+
label: "Back to live label",
|
|
341
|
+
initial_value: "Back To Live",
|
|
342
|
+
type: "text_input",
|
|
343
|
+
});
|
|
344
|
+
|
|
338
345
|
styles.fields.push(
|
|
339
346
|
fieldsGroup("Always Show Scrub Bar & Timestamp", "", [
|
|
340
347
|
{
|
|
@@ -447,7 +454,7 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
447
454
|
),
|
|
448
455
|
fieldsGroup(
|
|
449
456
|
"Skip Button",
|
|
450
|
-
"This section allows you to configure the skip button
|
|
457
|
+
"This section allows you to configure the skip button behaviour",
|
|
451
458
|
[
|
|
452
459
|
{
|
|
453
460
|
type: "switch",
|
|
@@ -464,6 +471,12 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
464
471
|
label: "Persistent Button Toggle",
|
|
465
472
|
initial_value: true,
|
|
466
473
|
},
|
|
474
|
+
]
|
|
475
|
+
),
|
|
476
|
+
fieldsGroup(
|
|
477
|
+
"Labeled Button Style",
|
|
478
|
+
"This section allows you to configure the labeled button styles",
|
|
479
|
+
[
|
|
467
480
|
{
|
|
468
481
|
type: "color_picker_rgba",
|
|
469
482
|
label_tooltip: "",
|
|
@@ -619,6 +632,44 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
619
632
|
);
|
|
620
633
|
}
|
|
621
634
|
|
|
635
|
+
if (isTV(platform)) {
|
|
636
|
+
general.fields.push(
|
|
637
|
+
{
|
|
638
|
+
key: "liveSeekingEnabled",
|
|
639
|
+
label: "Live Seeking Enabled",
|
|
640
|
+
initial_value: false,
|
|
641
|
+
type: "switch",
|
|
642
|
+
label_tooltip: "Enable Live Seek",
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
key: "minimumAllowedSeekableDurationInSeconds",
|
|
646
|
+
label: "Minimum allowed seekable duration in seconds",
|
|
647
|
+
initial_value: 300,
|
|
648
|
+
type: "number_input",
|
|
649
|
+
label_tooltip:
|
|
650
|
+
"If duration less than this value, player will disable 'liveSeekingEnabled' value",
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
key: "live_image",
|
|
654
|
+
label: "Live badge",
|
|
655
|
+
type: "uploader",
|
|
656
|
+
label_tooltip: "Override default live badge / icon",
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
key: "live_width",
|
|
660
|
+
label: "Live badge width",
|
|
661
|
+
type: "number_input",
|
|
662
|
+
initial_value: 85,
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
key: "live_height",
|
|
666
|
+
label: "Live badge height",
|
|
667
|
+
type: "number_input",
|
|
668
|
+
initial_value: 50,
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
|
|
622
673
|
if (isMobile(platform)) {
|
|
623
674
|
general.fields.push(
|
|
624
675
|
{
|
package/manifestUtils/keys.js
CHANGED
|
@@ -959,6 +959,27 @@ const TV_CELL_LABEL_FIELDS = [
|
|
|
959
959
|
rules: "conditional",
|
|
960
960
|
conditions: [{ key: "switch", section: "styles", value: true }],
|
|
961
961
|
},
|
|
962
|
+
{
|
|
963
|
+
type: ZAPPIFEST_FIELDS.font_selector.roku,
|
|
964
|
+
suffix: "roku font family",
|
|
965
|
+
tooltip: "",
|
|
966
|
+
rules: "conditional",
|
|
967
|
+
conditions: [{ key: "switch", section: "styles", value: true }],
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
971
|
+
suffix: "roku font size",
|
|
972
|
+
tooltip: "",
|
|
973
|
+
rules: "conditional",
|
|
974
|
+
conditions: [{ key: "switch", section: "styles", value: true }],
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
978
|
+
suffix: "roku line height",
|
|
979
|
+
tooltip: "",
|
|
980
|
+
rules: "conditional",
|
|
981
|
+
conditions: [{ key: "switch", section: "styles", value: true }],
|
|
982
|
+
},
|
|
962
983
|
{
|
|
963
984
|
type: ZAPPIFEST_FIELDS.select,
|
|
964
985
|
suffix: "text alignment",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.2535277107",
|
|
4
4
|
"description": "Applicaster Zapp React Native utilities package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@applicaster/applicaster-types": "15.0.0-alpha.
|
|
30
|
+
"@applicaster/applicaster-types": "15.0.0-alpha.2535277107",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useAccessibilityManager,
|
|
5
|
+
useAccessibilityState,
|
|
6
|
+
} from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
4
7
|
import { PlayerTTS } from "@applicaster/zapp-react-native-utils/playerUtils/PlayerTTS";
|
|
5
8
|
|
|
6
9
|
export const usePlayerTTS = () => {
|
|
7
10
|
const player = usePlayer();
|
|
8
11
|
const accessibilityManager = useAccessibilityManager({});
|
|
9
|
-
|
|
10
|
-
const isScreenReaderEnabled =
|
|
11
|
-
accessibilityManager.accessibilityManagerState.screenReaderEnabled;
|
|
12
|
+
const accessibilityState = useAccessibilityState();
|
|
13
|
+
const isScreenReaderEnabled = accessibilityState.screenReaderEnabled;
|
|
12
14
|
|
|
13
15
|
React.useEffect(() => {
|
|
14
16
|
if (player && accessibilityManager && isScreenReaderEnabled) {
|
|
@@ -147,17 +147,34 @@ export class TVSeekController
|
|
|
147
147
|
|
|
148
148
|
let targetPos = currentPos;
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
const isLive = this.playerController.isLive();
|
|
151
|
+
|
|
152
|
+
if (isLive) {
|
|
153
|
+
if (this.currentSeekType === SEEK_TYPE.REWIND) {
|
|
154
|
+
targetPos = Math.min(
|
|
155
|
+
currentPos + offset,
|
|
156
|
+
this.playerController.getSeekableDuration()
|
|
157
|
+
);
|
|
158
|
+
} else if (this.currentSeekType === SEEK_TYPE.FORWARD) {
|
|
159
|
+
targetPos = Math.max(0, currentPos - offset);
|
|
160
|
+
} else {
|
|
161
|
+
log_warning(
|
|
162
|
+
`TVSeekController: handleDelayedSeek - invalid seek type: ${this.currentSeekType}`
|
|
163
|
+
);
|
|
164
|
+
}
|
|
157
165
|
} else {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
166
|
+
if (this.currentSeekType === SEEK_TYPE.FORWARD) {
|
|
167
|
+
targetPos = Math.min(
|
|
168
|
+
currentPos + offset,
|
|
169
|
+
this.playerController.getSeekableDuration()
|
|
170
|
+
);
|
|
171
|
+
} else if (this.currentSeekType === SEEK_TYPE.REWIND) {
|
|
172
|
+
targetPos = Math.max(0, currentPos - offset);
|
|
173
|
+
} else {
|
|
174
|
+
log_warning(
|
|
175
|
+
`TVSeekController: handleDelayedSeek - invalid seek type: ${this.currentSeekType}`
|
|
176
|
+
);
|
|
177
|
+
}
|
|
161
178
|
}
|
|
162
179
|
|
|
163
180
|
log_debug(
|