@applicaster/quick-brick-player 13.0.5 → 13.0.6-alpha.4390983410
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 +6 -6
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +25 -81
- package/src/Player/AudioLayer/Layout/DockedControls/index.tsx +86 -101
- package/src/Player/AudioLayer/Layout/MobileLayout.tsx +4 -37
- package/src/Player/AudioLayer/Layout/PlayerImage/index.tsx +22 -72
- package/src/Player/AudioLayer/Layout/TabletLandscapeLayout.tsx +1 -58
- package/src/Player/AudioLayer/Layout/TabletPortraitLayout.tsx +0 -33
- package/src/Player/AudioLayer/Layout/TransportInfo/index.tsx +3 -9
- package/src/Player/PlayerModal/GestureAnimatedScrollView.ts +7 -0
- package/src/Player/PlayerModal/PlayerModal.tsx +109 -0
- package/src/Player/PlayerModal/VideoPlayerModal.tsx +237 -0
- package/src/Player/PlayerModal/consts/index.ts +34 -0
- package/src/Player/PlayerModal/hooks/index.ts +161 -0
- package/src/Player/PlayerModal/index.ts +3 -0
- package/src/Player/PlayerModal/styles.ts +101 -0
- package/src/Player/index.tsx +161 -105
package/src/Player/index.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
/* eslint-disable react-native/no-inline-styles */
|
|
1
2
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2
3
|
/* eslint-disable react-native/no-color-literals */
|
|
3
4
|
|
|
4
5
|
import React from "react";
|
|
5
6
|
import * as R from "ramda";
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import { findNodeHandle, StyleSheet, View, Dimensions } from "react-native";
|
|
8
9
|
|
|
9
|
-
import { findNodeHandle, StyleSheet, View } from "react-native";
|
|
10
10
|
import TransportControlsMobile from "@applicaster/quick-brick-mobile-transport-controls";
|
|
11
11
|
import TransportControlsTV from "@applicaster/quick-brick-tv-transport-controls";
|
|
12
12
|
|
|
@@ -19,7 +19,10 @@ import {
|
|
|
19
19
|
isWeb,
|
|
20
20
|
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
21
21
|
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
PlayerDetails,
|
|
24
|
+
PlayerWrapper,
|
|
25
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
|
|
23
26
|
|
|
24
27
|
import { PlayNextOverlay } from "./PlayNextOverlay";
|
|
25
28
|
import { PlayerImageBackground } from "@applicaster/zapp-react-native-ui-components/Components/PlayerImageBackground";
|
|
@@ -33,19 +36,20 @@ import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
|
33
36
|
import { getAllAccessibilityProps } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
34
37
|
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
35
38
|
import { getTargetScreenDataFromEntry } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
|
|
36
|
-
import {
|
|
37
|
-
AnimationComponent,
|
|
38
|
-
ComponentAnimationType,
|
|
39
|
-
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
40
39
|
import { PlayerAnalyticsManager } from "@applicaster/zapp-react-native-utils/analyticsUtils/PlayerAnalyticsManager";
|
|
41
40
|
import { PlayerAnalyticsTrackerI } from "@applicaster/zapp-react-native-utils/analyticsUtils/playerAnalyticsTracker";
|
|
42
41
|
|
|
43
42
|
import { RNPlayerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/nativePlayerManager";
|
|
44
43
|
import {
|
|
44
|
+
getTabletWidth,
|
|
45
45
|
isAudioItem as isAudioItemUtil,
|
|
46
46
|
isInlineTV as isInlineTVUtil,
|
|
47
47
|
} from "@applicaster/zapp-react-native-utils/playerUtils";
|
|
48
48
|
|
|
49
|
+
import PlayerModal, { VideoPlayerModal } from "./PlayerModal";
|
|
50
|
+
import { DockedControls } from "./AudioLayer/Layout/DockedControls";
|
|
51
|
+
import { FlexImage } from "./AudioLayer/Layout/PlayerImage/FlexImage";
|
|
52
|
+
|
|
49
53
|
const styles = StyleSheet.create({
|
|
50
54
|
container: { flex: 1 },
|
|
51
55
|
playerContainerBlack: { backgroundColor: DEFAULT_COLORS.black },
|
|
@@ -57,6 +61,7 @@ const styles = StyleSheet.create({
|
|
|
57
61
|
},
|
|
58
62
|
audioPlayerSize: { width: "100%", height: "100%" },
|
|
59
63
|
playerSize: { width: "100%", height: "100%" },
|
|
64
|
+
flexImage: { height: "100%", aspectRatio: 1, flex: -1 },
|
|
60
65
|
});
|
|
61
66
|
|
|
62
67
|
const logger = createLogger({
|
|
@@ -68,6 +73,15 @@ const isTvOS = isTvOSPlatform();
|
|
|
68
73
|
|
|
69
74
|
const AUDIO_PLAYER_NATIVE_ID = "audio-player-view";
|
|
70
75
|
|
|
76
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("screen");
|
|
77
|
+
|
|
78
|
+
const getScreenAspectRatio = () => {
|
|
79
|
+
const longEdge = Math.max(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
80
|
+
const shortEdge = Math.min(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
81
|
+
|
|
82
|
+
return longEdge / shortEdge;
|
|
83
|
+
};
|
|
84
|
+
|
|
71
85
|
export default class VideoPlayer extends React.Component<
|
|
72
86
|
QuickBrickPlayer.PlayerProps,
|
|
73
87
|
QuickBrickPlayer.NativePlayerState
|
|
@@ -1021,120 +1035,162 @@ export default class VideoPlayer extends React.Component<
|
|
|
1021
1035
|
pip: this.state.piped,
|
|
1022
1036
|
},
|
|
1023
1037
|
configuration: this.getPluginConfiguration(),
|
|
1024
|
-
|
|
1025
|
-
isTabletPortrait: isTabletPortrait,
|
|
1038
|
+
isTabletPortrait,
|
|
1026
1039
|
playNextData: this.getPlayNextData(),
|
|
1027
1040
|
};
|
|
1028
1041
|
|
|
1029
|
-
const containerStyle = { flex: 1 };
|
|
1030
|
-
|
|
1031
1042
|
const backgroundImageKey =
|
|
1032
1043
|
this.getPluginConfiguration()?.player_preview_image_key;
|
|
1033
1044
|
|
|
1034
1045
|
const shouldRenderNativePlayer =
|
|
1035
1046
|
!this.props.isCasting || this.supportNativeCast;
|
|
1036
1047
|
|
|
1048
|
+
const aspectRatio =
|
|
1049
|
+
!inline && isModal && !this.state.piped ? getScreenAspectRatio() : 16 / 9;
|
|
1050
|
+
|
|
1037
1051
|
const renderMobilePlayer = () => {
|
|
1038
1052
|
return isFullScreenAudioPlayer && isAudioItem ? (
|
|
1039
1053
|
// Ensure the View remains in the native hierarchy for proper rendering and interaction
|
|
1040
|
-
<
|
|
1041
|
-
{
|
|
1042
|
-
<
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1054
|
+
<PlayerModal
|
|
1055
|
+
content={
|
|
1056
|
+
<View collapsable={false} style={styles.container}>
|
|
1057
|
+
{shouldRenderNativePlayer ? (
|
|
1058
|
+
<this.props.PlayerComponent
|
|
1059
|
+
ref={this._assignRoot}
|
|
1060
|
+
{...nativeEvents}
|
|
1061
|
+
{...nativeProps}
|
|
1062
|
+
listener={this.props.listener}
|
|
1063
|
+
/>
|
|
1064
|
+
) : null}
|
|
1065
|
+
<AudioPlayerWrapper {...sharedWrapperViewProps} />
|
|
1066
|
+
</View>
|
|
1067
|
+
}
|
|
1068
|
+
collapsedContent={
|
|
1069
|
+
<View style={styles.container}>
|
|
1070
|
+
<DockedControls
|
|
1071
|
+
entry={entry}
|
|
1072
|
+
aspectRatio={1}
|
|
1073
|
+
layoutState={sharedWrapperViewProps.layoutState}
|
|
1074
|
+
playNextData={sharedWrapperViewProps.playNextData}
|
|
1075
|
+
ImageComponent={
|
|
1076
|
+
<FlexImage entry={entry} style={styles.flexImage} />
|
|
1077
|
+
}
|
|
1078
|
+
/>
|
|
1079
|
+
</View>
|
|
1080
|
+
}
|
|
1081
|
+
/>
|
|
1051
1082
|
) : (
|
|
1052
|
-
<
|
|
1053
|
-
{
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1083
|
+
<VideoPlayerModal
|
|
1084
|
+
enabled={!!isModal && !fullscreen}
|
|
1085
|
+
isTabletPortrait={isTabletPortrait}
|
|
1086
|
+
aspectRatio={aspectRatio}
|
|
1087
|
+
pip={this.state.piped}
|
|
1088
|
+
style={{
|
|
1089
|
+
tabletLandscapeWidth: getTabletWidth(
|
|
1090
|
+
this.getPluginConfiguration().tablet_landscape_sidebar_width,
|
|
1091
|
+
style
|
|
1092
|
+
),
|
|
1093
|
+
width: style.width,
|
|
1094
|
+
height: style.height,
|
|
1095
|
+
}}
|
|
1096
|
+
content={(_opacityAnim) => (
|
|
1097
|
+
<PlayerWrapper
|
|
1098
|
+
{...sharedWrapperViewProps}
|
|
1099
|
+
playerContent={(playerDimensions) => {
|
|
1100
|
+
const shouldRenderBackground =
|
|
1101
|
+
!R.isNil(backgroundImageKey) &&
|
|
1102
|
+
backgroundImageKey.length > 0 &&
|
|
1103
|
+
!this.onVideoLoadCalled &&
|
|
1104
|
+
!this.state.isAd;
|
|
1105
|
+
|
|
1106
|
+
return (
|
|
1107
|
+
<View style={styles.container}>
|
|
1108
|
+
<View style={[playerContainerStyles, playerDimensions]}>
|
|
1109
|
+
{isAudioItem ? (
|
|
1110
|
+
<AudioPlayer
|
|
1111
|
+
style={
|
|
1112
|
+
isTV()
|
|
1113
|
+
? getStyle(playerDimensions)
|
|
1114
|
+
: styles.playerSize
|
|
1115
|
+
}
|
|
1116
|
+
audio_item={entry}
|
|
1117
|
+
plugin_configuration={this.getPluginConfiguration()}
|
|
1118
|
+
/>
|
|
1119
|
+
) : null}
|
|
1120
|
+
|
|
1121
|
+
{shouldRenderBackground ? (
|
|
1122
|
+
<PlayerImageBackground
|
|
1123
|
+
imageKey={backgroundImageKey}
|
|
1124
|
+
configuration={this.getPluginConfiguration()}
|
|
1125
|
+
entry={entry}
|
|
1126
|
+
style={getBackgroundImageStyle(playerDimensions)}
|
|
1127
|
+
/>
|
|
1128
|
+
) : null}
|
|
1129
|
+
|
|
1130
|
+
{shouldRenderNativePlayer ? (
|
|
1131
|
+
<View style={getStyle(playerDimensions)}>
|
|
1132
|
+
<this.props.PlayerComponent
|
|
1133
|
+
ref={this._assignRoot}
|
|
1134
|
+
{...nativeEvents}
|
|
1135
|
+
{...nativeProps}
|
|
1136
|
+
listener={this.props.listener}
|
|
1137
|
+
style={
|
|
1138
|
+
isTV()
|
|
1139
|
+
? getStyle(playerDimensions)
|
|
1140
|
+
: styles.playerSize
|
|
1141
|
+
}
|
|
1142
|
+
pluginConfiguration={this.getPluginConfiguration()}
|
|
1143
|
+
controller={this.props.controller}
|
|
1144
|
+
>
|
|
1145
|
+
{this.props.children}
|
|
1146
|
+
</this.props.PlayerComponent>
|
|
1147
|
+
</View>
|
|
1148
|
+
) : null}
|
|
1149
|
+
</View>
|
|
1150
|
+
|
|
1151
|
+
{renderTransportControls(playerDimensions)}
|
|
1152
|
+
{!this.state.piped && (
|
|
1153
|
+
<PlayNextOverlay
|
|
1154
|
+
item={entry}
|
|
1155
|
+
playerIsDocked={docked}
|
|
1156
|
+
pluginConfiguration={this.getPluginConfiguration()}
|
|
1157
|
+
playerId={this.props.playerId}
|
|
1158
|
+
playNextData={this.getPlayNextData()}
|
|
1159
|
+
setNextVideoPreloadThresholdPercentage={
|
|
1160
|
+
this.props.setNextVideoPreloadThresholdPercentage
|
|
1077
1161
|
}
|
|
1078
|
-
audio_item={entry}
|
|
1079
|
-
plugin_configuration={this.getPluginConfiguration()}
|
|
1080
1162
|
/>
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
isTV()
|
|
1109
|
-
? getStyle(playerDimensions)
|
|
1110
|
-
: styles.playerSize
|
|
1111
|
-
}
|
|
1112
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1113
|
-
controller={this.props.controller}
|
|
1114
|
-
>
|
|
1115
|
-
{this.props.children}
|
|
1116
|
-
</this.props.PlayerComponent>
|
|
1117
|
-
</AnimationComponent>
|
|
1118
|
-
) : null}
|
|
1119
|
-
</View>
|
|
1120
|
-
|
|
1121
|
-
{renderTransportControls(playerDimensions)}
|
|
1122
|
-
{!this.state.piped && (
|
|
1123
|
-
<PlayNextOverlay
|
|
1124
|
-
item={entry}
|
|
1125
|
-
playerIsDocked={docked}
|
|
1126
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1127
|
-
playerId={this.props.playerId}
|
|
1128
|
-
playNextData={this.getPlayNextData()}
|
|
1129
|
-
setNextVideoPreloadThresholdPercentage={
|
|
1130
|
-
this.props.setNextVideoPreloadThresholdPercentage
|
|
1131
|
-
}
|
|
1132
|
-
/>
|
|
1133
|
-
)}
|
|
1163
|
+
)}
|
|
1164
|
+
</View>
|
|
1165
|
+
);
|
|
1166
|
+
}}
|
|
1167
|
+
/>
|
|
1168
|
+
)}
|
|
1169
|
+
extraContent={(_opacityAnim) => (
|
|
1170
|
+
<PlayerDetails
|
|
1171
|
+
configuration={this.getPluginConfiguration()}
|
|
1172
|
+
style={{ flex: 1 }}
|
|
1173
|
+
entry={entry}
|
|
1174
|
+
isTabletLandscape={!isTabletPortrait}
|
|
1175
|
+
inline={inline}
|
|
1176
|
+
docked={docked}
|
|
1177
|
+
isModal={isModal}
|
|
1178
|
+
pip={this.state.piped}
|
|
1179
|
+
/>
|
|
1180
|
+
)}
|
|
1181
|
+
collapsedContent={(_opacityAnim) =>
|
|
1182
|
+
this.state.piped ? null : (
|
|
1183
|
+
<View style={styles.container}>
|
|
1184
|
+
<DockedControls
|
|
1185
|
+
entry={entry}
|
|
1186
|
+
aspectRatio={aspectRatio}
|
|
1187
|
+
layoutState={sharedWrapperViewProps.layoutState}
|
|
1188
|
+
playNextData={sharedWrapperViewProps.playNextData}
|
|
1189
|
+
/>
|
|
1134
1190
|
</View>
|
|
1135
|
-
)
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1191
|
+
)
|
|
1192
|
+
}
|
|
1193
|
+
/>
|
|
1138
1194
|
);
|
|
1139
1195
|
};
|
|
1140
1196
|
|