@applicaster/zapp-react-native-ui-components 12.0.0-alpha.7257632022 → 12.0.0-alpha.7725319213
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/MasterCell/DefaultComponents/BorderContainerView/index.tsx +0 -1
- package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +10 -6
- package/Components/PlayerContainer/PlayerContainer.tsx +3 -1
- package/Components/TrackedView/index.tsx +6 -3
- package/Components/VideoLive/LiveImageManager.ts +40 -11
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +79 -73
- package/Components/VideoModal/PlayerWrapper.tsx +1 -1
- 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);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compact,
|
|
3
3
|
ifElseFocusedSelected,
|
|
4
|
+
ifElseSelected,
|
|
4
5
|
} from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
5
6
|
|
|
6
7
|
import { getPositionStyles } from "./utils";
|
|
@@ -12,9 +13,15 @@ type Props = {
|
|
|
12
13
|
value: Function;
|
|
13
14
|
state: string;
|
|
14
15
|
visible?: Boolean;
|
|
16
|
+
isMobile?: Boolean;
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
export const CellBadge = ({
|
|
19
|
+
export const CellBadge = ({
|
|
20
|
+
value,
|
|
21
|
+
state,
|
|
22
|
+
visible = true,
|
|
23
|
+
isMobile = false,
|
|
24
|
+
}: Props) => {
|
|
18
25
|
if (!value("cell_badge_switch") || !visible) {
|
|
19
26
|
return null;
|
|
20
27
|
}
|
|
@@ -45,13 +52,19 @@ export const CellBadge = ({ value, state, visible = true }: Props) => {
|
|
|
45
52
|
data: [
|
|
46
53
|
{
|
|
47
54
|
func: () => {
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
return isMobile
|
|
56
|
+
? ifElseSelected(
|
|
57
|
+
state,
|
|
58
|
+
value("cell_badge_selected"),
|
|
59
|
+
value("cell_badge_default")
|
|
60
|
+
)
|
|
61
|
+
: ifElseFocusedSelected(
|
|
62
|
+
state,
|
|
63
|
+
value("cell_badge_focused"),
|
|
64
|
+
value("cell_badge_selected"),
|
|
65
|
+
value("cell_badge_focused_selected"),
|
|
66
|
+
value("cell_badge_default")
|
|
67
|
+
);
|
|
55
68
|
},
|
|
56
69
|
args: [],
|
|
57
70
|
propName: "uri",
|
|
@@ -50,13 +50,17 @@ export const CollapsibleTextContainer = ({
|
|
|
50
50
|
func: (data) => {
|
|
51
51
|
const value = getValue("background_color");
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
const valueFromData = pathOr(value, value.split("."), data);
|
|
54
|
+
|
|
55
|
+
if (
|
|
56
|
+
valueFromData &&
|
|
57
|
+
(valueFromData.startsWith("#") || valueFromData.startsWith("rgba("))
|
|
58
|
+
) {
|
|
59
|
+
return valueFromData;
|
|
59
60
|
}
|
|
61
|
+
|
|
62
|
+
// return default value
|
|
63
|
+
return additionalStyles.backgroundColor;
|
|
60
64
|
},
|
|
61
65
|
propName: "backgroundColor",
|
|
62
66
|
},
|
|
@@ -580,6 +580,8 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
580
580
|
pluginConfiguration,
|
|
581
581
|
};
|
|
582
582
|
|
|
583
|
+
console.log("Anton player container", {result: {isAppleTV: isAppleTV(), notInlineTv: !isInlineTV}});
|
|
584
|
+
|
|
583
585
|
return (
|
|
584
586
|
<PlayerStateContext.Provider value={value}>
|
|
585
587
|
<PlayerContainerContextProvider
|
|
@@ -621,7 +623,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
621
623
|
}}
|
|
622
624
|
focused={isInlineTV ? true : undefined}
|
|
623
625
|
autoplay={true}
|
|
624
|
-
controls={
|
|
626
|
+
controls={false}
|
|
625
627
|
disableCastAction={disableCastAction}
|
|
626
628
|
docked={navigator.isVideoModalDocked()}
|
|
627
629
|
entry={item}
|
|
@@ -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>;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
import { setUserCellPlayerMutedPreference } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/userCellPlayerMutedPreference";
|
|
7
7
|
import { loggerLiveImageManager } from "./loggerHelper";
|
|
8
8
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
9
|
+
import { Component } from "react";
|
|
9
10
|
|
|
10
11
|
const { log_debug, log_info, log_error } = loggerLiveImageManager;
|
|
11
12
|
|
|
@@ -36,7 +37,8 @@ type Position = {
|
|
|
36
37
|
type LiveImageProps = {
|
|
37
38
|
player: Player;
|
|
38
39
|
playerId: string;
|
|
39
|
-
setMode
|
|
40
|
+
setMode?: (type: LiveImageType) => void;
|
|
41
|
+
component: Component;
|
|
40
42
|
// TODO: ...primary, powerCell, tvGallery, etc.
|
|
41
43
|
// type: string;
|
|
42
44
|
};
|
|
@@ -164,7 +166,7 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
164
166
|
|
|
165
167
|
// Fake close event, because we unmount native view
|
|
166
168
|
item.player?.onPlayerClose();
|
|
167
|
-
item.setMode(LiveImageType.Image);
|
|
169
|
+
item.setMode?.(LiveImageType.Image);
|
|
168
170
|
|
|
169
171
|
if (item === this.currentlyPlaying) {
|
|
170
172
|
this.currentlyPlaying = null;
|
|
@@ -191,8 +193,7 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
this.currentlyPlaying = item;
|
|
194
|
-
|
|
195
|
-
item.setMode(LiveImageType.Video);
|
|
196
|
+
item.setMode?.(LiveImageType.Video);
|
|
196
197
|
|
|
197
198
|
if (item.player.playerState.isReadyToPlay) {
|
|
198
199
|
item.player.play();
|
|
@@ -209,6 +210,11 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
209
210
|
this.pauseItem(item);
|
|
210
211
|
};
|
|
211
212
|
|
|
213
|
+
public onLiveImageCompleted = (_item: LiveImage) => {
|
|
214
|
+
// TODO: Notify listeners that player has died
|
|
215
|
+
// Do not try look for new playable, otherwise you will restart video finish to play
|
|
216
|
+
};
|
|
217
|
+
|
|
212
218
|
public muteAll = () => {
|
|
213
219
|
log_debug("muteAll");
|
|
214
220
|
|
|
@@ -235,6 +241,14 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
235
241
|
const playerItem = this.findNextPlayableItem();
|
|
236
242
|
|
|
237
243
|
if (playerItem) {
|
|
244
|
+
if (!playerItem.isFullyVisible) {
|
|
245
|
+
log_error(
|
|
246
|
+
`checkPlayerPosition: trying to start playback currently invisible item: ${playerInfo(
|
|
247
|
+
playerItem.player
|
|
248
|
+
)}`
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
238
252
|
// Will also check if it's item that already playing
|
|
239
253
|
this.playLiveImage(playerItem);
|
|
240
254
|
}
|
|
@@ -242,7 +256,6 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
242
256
|
|
|
243
257
|
onPrimaryPlayerClosed = () => {
|
|
244
258
|
const playerItem = this.findNextPlayableItem();
|
|
245
|
-
|
|
246
259
|
log_info("onPrimaryPlayerClosed: starting to play visible live-image");
|
|
247
260
|
|
|
248
261
|
this.currentlyPlaying = null;
|
|
@@ -361,7 +374,7 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
361
374
|
|
|
362
375
|
// TODO: ...Maybe player some other item
|
|
363
376
|
} else {
|
|
364
|
-
item.setMode(LiveImageType.Image);
|
|
377
|
+
item.setMode?.(LiveImageType.Image);
|
|
365
378
|
}
|
|
366
379
|
|
|
367
380
|
// Prevent receiving onEnd event from both `close` and `end` player events
|
|
@@ -377,10 +390,25 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
377
390
|
};
|
|
378
391
|
|
|
379
392
|
onLiveImageError = (item: LiveImage, error: Error) => {
|
|
380
|
-
item.setMode(LiveImageType.Image);
|
|
393
|
+
item.setMode?.(LiveImageType.Image);
|
|
381
394
|
|
|
382
|
-
|
|
395
|
+
const currentItem = this.currentlyPlaying;
|
|
396
|
+
|
|
397
|
+
log_debug(
|
|
398
|
+
`onLiveImageError: error: ${error.message}, live-image ${playerInfo(
|
|
399
|
+
item.player
|
|
400
|
+
)}, currentPlayingId: ${
|
|
401
|
+
this.currentlyPlaying?.playerId
|
|
402
|
+
}, primaryPlayerId: ${this.primaryPlayer?.playerId}`
|
|
403
|
+
);
|
|
404
|
+
|
|
405
|
+
if (currentItem === item) {
|
|
383
406
|
this.currentlyPlaying = null;
|
|
407
|
+
|
|
408
|
+
log_debug(
|
|
409
|
+
`onLiveImageError: currentitem: ${currentItem.playerId} was removed`
|
|
410
|
+
);
|
|
411
|
+
|
|
384
412
|
// TODO: ...Maybe player some other item
|
|
385
413
|
}
|
|
386
414
|
|
|
@@ -389,8 +417,8 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
389
417
|
event: {
|
|
390
418
|
item,
|
|
391
419
|
error,
|
|
392
|
-
playerId:
|
|
393
|
-
primaryPlayerId:
|
|
420
|
+
playerId: currentItem?.playerId,
|
|
421
|
+
primaryPlayerId: currentItem?.playerId,
|
|
394
422
|
},
|
|
395
423
|
});
|
|
396
424
|
};
|
|
@@ -446,12 +474,13 @@ export class LiveImage implements QuickBrickPlayer.SharedPlayerCallBacks {
|
|
|
446
474
|
};
|
|
447
475
|
|
|
448
476
|
readonly playerId: string;
|
|
477
|
+
readonly component: Component;
|
|
449
478
|
|
|
450
479
|
constructor(props: LiveImageProps) {
|
|
451
480
|
this.player = props.player;
|
|
452
481
|
this.setMode = props.setMode;
|
|
453
482
|
this.playerId = this.player.playerId;
|
|
454
|
-
|
|
483
|
+
this.component = props.component;
|
|
455
484
|
this.player.addListener({ id: "live-image", listener: this });
|
|
456
485
|
}
|
|
457
486
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// /// <reference types="@applicaster/applicaster-types" />
|
|
2
2
|
//
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import * as R from "ramda";
|
|
5
4
|
|
|
6
5
|
import { AppState, AppStateStatus } from "react-native";
|
|
7
6
|
import { TrackedView } from "../TrackedView";
|
|
@@ -9,7 +8,6 @@ import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/l
|
|
|
9
8
|
|
|
10
9
|
import { playerFactory } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerFactory";
|
|
11
10
|
|
|
12
|
-
import { BufferAnimation } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/BufferAnimation";
|
|
13
11
|
import {
|
|
14
12
|
isApplePlatform,
|
|
15
13
|
isTV,
|
|
@@ -25,12 +23,13 @@ import { loggerLiveImageComponent } from "./loggerHelper";
|
|
|
25
23
|
import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
|
|
26
24
|
import { PlayerRole } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/conts";
|
|
27
25
|
import { getAutoplaySettings } from "./utils";
|
|
26
|
+
import { isString } from "@applicaster/zapp-react-native-utils/stringUtils";
|
|
27
|
+
import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
|
|
28
28
|
|
|
29
29
|
const { log_error } = loggerLiveImageComponent;
|
|
30
30
|
|
|
31
|
-
const isMeasurement = (item) =>
|
|
32
|
-
|
|
33
|
-
};
|
|
31
|
+
const isMeasurement = (item: ZappEntry) =>
|
|
32
|
+
isString(item.id) && item.id.startsWith("pre-measurement-");
|
|
34
33
|
|
|
35
34
|
type Props = {
|
|
36
35
|
item: ZappEntry;
|
|
@@ -55,69 +54,66 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
55
54
|
isTV() ? false : getUserCellPlayerMutedPreference(props.audioMutedByDefault)
|
|
56
55
|
);
|
|
57
56
|
|
|
58
|
-
const [PlayerViewComponent, setPlayerViewComponent] = React.useState(null);
|
|
59
|
-
const Player: any = PlayerViewComponent || BufferAnimation;
|
|
60
|
-
|
|
61
57
|
const ref = React.useRef(null);
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (type ===
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
timeoutRef.current = setTimeout(() => {
|
|
78
|
-
setMode(type);
|
|
79
|
-
}, 1000) as unknown as NodeJS.Timeout;
|
|
80
|
-
} else {
|
|
81
|
-
if (timeoutRef.current) {
|
|
82
|
-
clearTimeout(timeoutRef.current);
|
|
83
|
-
}
|
|
59
|
+
/**
|
|
60
|
+
* Debounced setMode function.
|
|
61
|
+
*
|
|
62
|
+
* Sets to video with a 1sec delay. Set to image happens immediately and cancels the timeout.
|
|
63
|
+
*
|
|
64
|
+
* @param type video or image
|
|
65
|
+
*/
|
|
66
|
+
const setModeDebounced = React.useCallback((type: LiveImageType) => {
|
|
67
|
+
if (type === LiveImageType.Video) {
|
|
68
|
+
if (type === mode) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
84
71
|
|
|
72
|
+
timeoutRef.current = setTimeout(() => {
|
|
85
73
|
setMode(type);
|
|
74
|
+
}, 1000) as unknown as NodeJS.Timeout;
|
|
75
|
+
} else {
|
|
76
|
+
if (timeoutRef.current) {
|
|
77
|
+
clearTimeout(timeoutRef.current);
|
|
78
|
+
timeoutRef.current = null;
|
|
86
79
|
}
|
|
87
|
-
};
|
|
88
80
|
|
|
81
|
+
setMode(type);
|
|
82
|
+
}
|
|
83
|
+
}, [mode]);
|
|
84
|
+
|
|
85
|
+
const { screenConfig, playerPluginId } = props;
|
|
86
|
+
|
|
87
|
+
const liveImageItem: LiveImage = React.useMemo(() => {
|
|
89
88
|
const playerFactoryItem = playerFactory({
|
|
90
89
|
player: ref,
|
|
91
|
-
listener: props as Record<string, any>,
|
|
92
90
|
playerId,
|
|
93
91
|
autoplay: false,
|
|
94
92
|
entry: item,
|
|
95
|
-
muted,
|
|
96
|
-
playerPluginId:
|
|
97
|
-
screenConfig:
|
|
93
|
+
muted, // Initial muted state, not needed in dependencies
|
|
94
|
+
playerPluginId: playerPluginId,
|
|
95
|
+
screenConfig: screenConfig,
|
|
98
96
|
playerRole: PlayerRole.Cell,
|
|
99
97
|
});
|
|
100
98
|
|
|
101
|
-
const Component = playerFactoryItem?.Component;
|
|
102
|
-
|
|
103
|
-
if (!R.isNil(Component) && Component !== PlayerViewComponent) {
|
|
104
|
-
setPlayerViewComponent(Component);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
99
|
if (playerFactoryItem) {
|
|
108
100
|
return new LiveImage({
|
|
109
101
|
playerId,
|
|
110
102
|
player: playerFactoryItem.controller,
|
|
111
|
-
|
|
103
|
+
component: playerFactoryItem?.Component
|
|
112
104
|
});
|
|
113
105
|
} else {
|
|
114
106
|
throw new Error("Player factory item is null");
|
|
115
107
|
}
|
|
116
|
-
}, [playerId, item
|
|
108
|
+
}, [playerId, item, playerPluginId, screenConfig]);
|
|
109
|
+
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
liveImageItem.setMode = setModeDebounced;
|
|
112
|
+
}, [setModeDebounced, liveImageItem]);
|
|
117
113
|
|
|
118
114
|
const { start, end } = React.useMemo(
|
|
119
115
|
() => getAutoplaySettings(item),
|
|
120
|
-
[item
|
|
116
|
+
[item]
|
|
121
117
|
);
|
|
122
118
|
|
|
123
119
|
const controller = liveImageItem.getPlayer();
|
|
@@ -127,6 +123,10 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
127
123
|
ref.current = component;
|
|
128
124
|
};
|
|
129
125
|
|
|
126
|
+
const onLiveImageCompleted = React.useCallback(() => {
|
|
127
|
+
LiveImageManager.instance.onLiveImageCompleted(liveImageItem);
|
|
128
|
+
}, [liveImageItem]);
|
|
129
|
+
|
|
130
130
|
const onStop = React.useCallback(() => {
|
|
131
131
|
LiveImageManager.instance.pauseLiveImage(liveImageItem);
|
|
132
132
|
}, [liveImageItem]);
|
|
@@ -140,13 +140,14 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
140
140
|
const unregister = LiveImageManager.instance.register(liveImageItem);
|
|
141
141
|
|
|
142
142
|
return () => {
|
|
143
|
-
unregister();
|
|
144
|
-
|
|
145
143
|
if (timeoutRef.current) {
|
|
146
144
|
clearTimeout(timeoutRef.current);
|
|
145
|
+
timeoutRef.current = null;
|
|
147
146
|
}
|
|
147
|
+
|
|
148
|
+
unregister();
|
|
148
149
|
};
|
|
149
|
-
}, [
|
|
150
|
+
}, [item, liveImageItem]);
|
|
150
151
|
|
|
151
152
|
React.useEffect(() => {
|
|
152
153
|
if (!player) {
|
|
@@ -178,11 +179,12 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
178
179
|
setMuted(false);
|
|
179
180
|
},
|
|
180
181
|
onPlayerClose: () => {
|
|
182
|
+
onLiveImageCompleted();
|
|
181
183
|
setIsReady(false);
|
|
182
184
|
},
|
|
183
185
|
},
|
|
184
186
|
});
|
|
185
|
-
}, [player, onStop]);
|
|
187
|
+
}, [player, onStop, onLiveImageCompleted, start, end]);
|
|
186
188
|
|
|
187
189
|
React.useEffect(() => {
|
|
188
190
|
const subscription = AppState.addEventListener(
|
|
@@ -233,40 +235,43 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
233
235
|
};
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
|
-
}, [liveImageItem]);
|
|
238
|
+
}, [liveImageItem, playerId, controller]);
|
|
237
239
|
|
|
238
|
-
const onPositionUpdated = (
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
const onPositionUpdated = React.useCallback(
|
|
241
|
+
(data) => {
|
|
242
|
+
const normalizedRect = (rect: {left: number, right: number, top: number, bottom: number }) => {
|
|
243
|
+
if (!rect) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
243
246
|
|
|
244
|
-
|
|
247
|
+
const { left, right, top, bottom } = rect;
|
|
245
248
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
return {
|
|
250
|
+
left: left / dimensions.width,
|
|
251
|
+
right: right / dimensions.width,
|
|
252
|
+
top: top / dimensions.height,
|
|
253
|
+
bottom: bottom / dimensions.height,
|
|
254
|
+
centerX: (left + right) / 2 / dimensions.width,
|
|
255
|
+
centerY: (top + bottom) / 2 / dimensions.height,
|
|
256
|
+
};
|
|
253
257
|
};
|
|
254
|
-
};
|
|
255
258
|
|
|
256
|
-
|
|
259
|
+
liveImageItem.position = normalizedRect(data.rect);
|
|
257
260
|
|
|
258
|
-
|
|
261
|
+
const newIsFullyVisible = !!data.rect;
|
|
259
262
|
|
|
260
|
-
|
|
261
|
-
|
|
263
|
+
if (liveImageItem.isFullyVisible !== newIsFullyVisible) {
|
|
264
|
+
liveImageItem.isFullyVisible = newIsFullyVisible;
|
|
262
265
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
266
|
+
liveImageItem.isFullyVisible
|
|
267
|
+
? LiveImageManager.instance.onViewportEnter(liveImageItem)
|
|
268
|
+
: LiveImageManager.instance.onViewportLeave(liveImageItem);
|
|
269
|
+
} else {
|
|
270
|
+
LiveImageManager.instance.checkPlayerPosition(liveImageItem);
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
[liveImageItem, dimensions]
|
|
274
|
+
);
|
|
270
275
|
|
|
271
276
|
const platformSpecificProps = isApplePlatform()
|
|
272
277
|
? { hideNativeControls: true, controls: false }
|
|
@@ -276,6 +281,7 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
276
281
|
const isVideoMode = mode === LiveImageType.Video;
|
|
277
282
|
const isBackgroundImageVisible = isImageMode || !isReadyToPlay;
|
|
278
283
|
const videoStyles = { ...style, position: "absolute", zIndex: -100 };
|
|
284
|
+
const Player: any = liveImageItem.component || BufferAnimation;
|
|
279
285
|
|
|
280
286
|
return (
|
|
281
287
|
<TrackedView
|
|
@@ -162,7 +162,7 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
162
162
|
width: isInlineModal && docked ? undefined : baseDimensions.width,
|
|
163
163
|
aspectRatio: !isInlineModal && !pip ? getScreenAspectRatio() : 16 / 9,
|
|
164
164
|
}),
|
|
165
|
-
[baseDimensions, isInlineModal]
|
|
165
|
+
[baseDimensions, isInlineModal, pip]
|
|
166
166
|
);
|
|
167
167
|
|
|
168
168
|
const containerDimensions: DimensionsT = React.useMemo(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.7725319213",
|
|
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-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
37
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.7725319213",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7725319213",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.7725319213",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.7725319213",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|