@applicaster/zapp-react-native-ui-components 12.0.0-rc.17 → 12.0.0-rc.19
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/Components/GeneralContentScreen/GeneralContentScreen.tsx +5 -5
- package/Components/HandlePlayable/HandlePlayable.tsx +1 -1
- package/Components/TrackedView/index.tsx +6 -3
- package/Components/VideoLive/LiveImageManager.ts +13 -0
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +38 -28
- package/package.json +5 -5
|
@@ -52,13 +52,13 @@ export const GeneralContentScreen = ({
|
|
|
52
52
|
React.useState(actionsInitialStateSetters.length === 0);
|
|
53
53
|
|
|
54
54
|
useEffect(() => {
|
|
55
|
-
log_info(
|
|
56
|
-
`ScreenContainer: starting to check river action provider ready, current status: ${riverActionProvidersReady}`,
|
|
57
|
-
{ actionsInitialStateSetters }
|
|
58
|
-
);
|
|
59
|
-
|
|
60
55
|
if (!riverActionProvidersReady) {
|
|
61
56
|
if (actionsInitialStateSetters.length > 0) {
|
|
57
|
+
log_info(
|
|
58
|
+
"ScreenContainer: starting to check river action providers to initialize",
|
|
59
|
+
{ actionsInitialStateSetters }
|
|
60
|
+
);
|
|
61
|
+
|
|
62
62
|
allSettled(actionsInitialStateSetters).finally(() => {
|
|
63
63
|
log_info(
|
|
64
64
|
"ScreenContainer: action provider ready, completed. Starting to present screen"
|
|
@@ -104,7 +104,7 @@ export function HandlePlayable({
|
|
|
104
104
|
const [Player, playerModuleProperties] = getPlayer(item, state);
|
|
105
105
|
|
|
106
106
|
const { module: CastPlugin } =
|
|
107
|
-
findPluginByIdentifier(CHROMECAST_PLUGIN_ID, state.plugins) || {};
|
|
107
|
+
findPluginByIdentifier(CHROMECAST_PLUGIN_ID, state.plugins, true) || {};
|
|
108
108
|
|
|
109
109
|
const [playable, setPlayable] =
|
|
110
110
|
React.useState<Nullable<PlayableComponent>>(null);
|
|
@@ -17,9 +17,12 @@ type TrackedViewProps = {
|
|
|
17
17
|
export const TrackedView = memo(function TrackedView(props: TrackedViewProps) {
|
|
18
18
|
const children = props.children;
|
|
19
19
|
|
|
20
|
-
const onPositionUpdated = useCallback(
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const onPositionUpdated = useCallback(
|
|
21
|
+
(event: TrackedViewNativeProps) => {
|
|
22
|
+
props.onPositionUpdated(event.nativeEvent);
|
|
23
|
+
},
|
|
24
|
+
[props.onPositionUpdated]
|
|
25
|
+
);
|
|
23
26
|
|
|
24
27
|
if (isTV()) {
|
|
25
28
|
return <View {...(props as any)}>{children}</View>;
|
|
@@ -209,6 +209,11 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
209
209
|
this.pauseItem(item);
|
|
210
210
|
};
|
|
211
211
|
|
|
212
|
+
public onLiveImageCompleted = (item: LiveImage) => {
|
|
213
|
+
// TODO: Notify listeners that player has died
|
|
214
|
+
// Do not try look for new playable, otherwise you will restart video finish to play
|
|
215
|
+
};
|
|
216
|
+
|
|
212
217
|
public muteAll = () => {
|
|
213
218
|
log_debug("muteAll");
|
|
214
219
|
|
|
@@ -235,6 +240,14 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
235
240
|
const playerItem = this.findNextPlayableItem();
|
|
236
241
|
|
|
237
242
|
if (playerItem) {
|
|
243
|
+
if (!playerItem.isFullyVisible) {
|
|
244
|
+
log_error(
|
|
245
|
+
`checkPlayerPosition: trying to start playback currently invisible item: ${playerInfo(
|
|
246
|
+
playerItem.player
|
|
247
|
+
)}`
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
238
251
|
// Will also check if it's item that already playing
|
|
239
252
|
this.playLiveImage(playerItem);
|
|
240
253
|
}
|
|
@@ -80,6 +80,7 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
80
80
|
} else {
|
|
81
81
|
if (timeoutRef.current) {
|
|
82
82
|
clearTimeout(timeoutRef.current);
|
|
83
|
+
timeoutRef.current = null;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
setMode(type);
|
|
@@ -127,6 +128,10 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
127
128
|
ref.current = component;
|
|
128
129
|
};
|
|
129
130
|
|
|
131
|
+
const onLiveImageCompleted = React.useCallback(() => {
|
|
132
|
+
LiveImageManager.instance.onLiveImageCompleted(liveImageItem);
|
|
133
|
+
}, [liveImageItem]);
|
|
134
|
+
|
|
130
135
|
const onStop = React.useCallback(() => {
|
|
131
136
|
LiveImageManager.instance.pauseLiveImage(liveImageItem);
|
|
132
137
|
}, [liveImageItem]);
|
|
@@ -144,9 +149,10 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
144
149
|
|
|
145
150
|
if (timeoutRef.current) {
|
|
146
151
|
clearTimeout(timeoutRef.current);
|
|
152
|
+
timeoutRef.current = null;
|
|
147
153
|
}
|
|
148
154
|
};
|
|
149
|
-
}, [liveImageItem, item]);
|
|
155
|
+
}, [liveImageItem, item, timeoutRef.current]);
|
|
150
156
|
|
|
151
157
|
React.useEffect(() => {
|
|
152
158
|
if (!player) {
|
|
@@ -178,11 +184,12 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
178
184
|
setMuted(false);
|
|
179
185
|
},
|
|
180
186
|
onPlayerClose: () => {
|
|
187
|
+
onLiveImageCompleted();
|
|
181
188
|
setIsReady(false);
|
|
182
189
|
},
|
|
183
190
|
},
|
|
184
191
|
});
|
|
185
|
-
}, [player, onStop]);
|
|
192
|
+
}, [player, onStop, onLiveImageCompleted, start, end]);
|
|
186
193
|
|
|
187
194
|
React.useEffect(() => {
|
|
188
195
|
const subscription = AppState.addEventListener(
|
|
@@ -233,40 +240,43 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
233
240
|
};
|
|
234
241
|
}
|
|
235
242
|
}
|
|
236
|
-
}, [liveImageItem]);
|
|
243
|
+
}, [liveImageItem, playerId, controller]);
|
|
237
244
|
|
|
238
|
-
const onPositionUpdated = (
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
245
|
+
const onPositionUpdated = React.useCallback(
|
|
246
|
+
(data) => {
|
|
247
|
+
const normalizedRect = (rect) => {
|
|
248
|
+
if (!rect) {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
243
251
|
|
|
244
|
-
|
|
252
|
+
const { left, right, top, bottom } = rect;
|
|
245
253
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
254
|
+
return {
|
|
255
|
+
left: left / dimensions.width,
|
|
256
|
+
right: right / dimensions.width,
|
|
257
|
+
top: top / dimensions.height,
|
|
258
|
+
bottom: bottom / dimensions.height,
|
|
259
|
+
centerX: (left + right) / 2 / dimensions.width,
|
|
260
|
+
centerY: (top + bottom) / 2 / dimensions.height,
|
|
261
|
+
};
|
|
253
262
|
};
|
|
254
|
-
};
|
|
255
263
|
|
|
256
|
-
|
|
264
|
+
liveImageItem.position = normalizedRect(data.rect);
|
|
257
265
|
|
|
258
|
-
|
|
266
|
+
const newIsFullyVisible = !!data.rect;
|
|
259
267
|
|
|
260
|
-
|
|
261
|
-
|
|
268
|
+
if (liveImageItem.isFullyVisible !== newIsFullyVisible) {
|
|
269
|
+
liveImageItem.isFullyVisible = newIsFullyVisible;
|
|
262
270
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
271
|
+
liveImageItem.isFullyVisible
|
|
272
|
+
? LiveImageManager.instance.onViewportEnter(liveImageItem)
|
|
273
|
+
: LiveImageManager.instance.onViewportLeave(liveImageItem);
|
|
274
|
+
} else {
|
|
275
|
+
LiveImageManager.instance.checkPlayerPosition(liveImageItem);
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
[liveImageItem, item?.id, playerId, dimensions]
|
|
279
|
+
);
|
|
270
280
|
|
|
271
281
|
const platformSpecificProps = isApplePlatform()
|
|
272
282
|
? { hideNativeControls: true, controls: false }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "12.0.0-rc.
|
|
3
|
+
"version": "12.0.0-rc.19",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"redux-mock-store": "^1.5.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@applicaster/applicaster-types": "12.0.0-rc.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-rc.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-rc.
|
|
37
|
+
"@applicaster/applicaster-types": "12.0.0-rc.19",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.19",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-rc.19",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-rc.19",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|