@applicaster/quick-brick-player 14.0.0-rc.32 → 14.0.0-rc.34
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 -104
package/src/Player/index.tsx
CHANGED
|
@@ -1,10 +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 { findNodeHandle, StyleSheet, View } from "react-native";
|
|
8
|
+
import { findNodeHandle, StyleSheet, View, Dimensions } from "react-native";
|
|
9
|
+
|
|
8
10
|
import TransportControlsMobile from "@applicaster/quick-brick-mobile-transport-controls";
|
|
9
11
|
import TransportControlsTV from "@applicaster/quick-brick-tv-transport-controls";
|
|
10
12
|
|
|
@@ -17,7 +19,10 @@ import {
|
|
|
17
19
|
isWeb,
|
|
18
20
|
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
19
21
|
|
|
20
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
PlayerDetails,
|
|
24
|
+
PlayerWrapper,
|
|
25
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
|
|
21
26
|
|
|
22
27
|
import { PlayNextOverlay } from "./PlayNextOverlay";
|
|
23
28
|
import { PlayerImageBackground } from "@applicaster/zapp-react-native-ui-components/Components/PlayerImageBackground";
|
|
@@ -31,20 +36,20 @@ import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
|
31
36
|
import { getAllAccessibilityProps } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
32
37
|
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
33
38
|
import { getTargetScreenDataFromEntry } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
|
|
34
|
-
import {
|
|
35
|
-
AnimationComponent,
|
|
36
|
-
ComponentAnimationType,
|
|
37
|
-
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
38
39
|
import { PlayerAnalyticsManager } from "@applicaster/zapp-react-native-utils/analyticsUtils/PlayerAnalyticsManager";
|
|
39
40
|
import { PlayerAnalyticsTrackerI } from "@applicaster/zapp-react-native-utils/analyticsUtils/playerAnalyticsTracker";
|
|
40
41
|
|
|
41
42
|
import { RNPlayerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/nativePlayerManager";
|
|
42
43
|
import {
|
|
44
|
+
getTabletWidth,
|
|
43
45
|
isAudioItem as isAudioItemUtil,
|
|
44
46
|
isInlineTV as isInlineTVUtil,
|
|
45
47
|
} from "@applicaster/zapp-react-native-utils/playerUtils";
|
|
46
48
|
|
|
47
49
|
import { TVPlayerView } from "./PlayerView/TVPlayerView";
|
|
50
|
+
import PlayerModal, { VideoPlayerModal } from "./PlayerModal";
|
|
51
|
+
import { DockedControls } from "./AudioLayer/Layout/DockedControls";
|
|
52
|
+
import { FlexImage } from "./AudioLayer/Layout/PlayerImage/FlexImage";
|
|
48
53
|
|
|
49
54
|
const styles = StyleSheet.create({
|
|
50
55
|
container: { flex: 1 },
|
|
@@ -56,6 +61,7 @@ const styles = StyleSheet.create({
|
|
|
56
61
|
zIndex: 1,
|
|
57
62
|
},
|
|
58
63
|
playerSize: { width: "100%", height: "100%" },
|
|
64
|
+
flexImage: { height: "100%", aspectRatio: 1, flex: -1 },
|
|
59
65
|
});
|
|
60
66
|
|
|
61
67
|
const logger = createLogger({
|
|
@@ -65,6 +71,15 @@ const logger = createLogger({
|
|
|
65
71
|
|
|
66
72
|
const isTvOS = isTvOSPlatform();
|
|
67
73
|
|
|
74
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("screen");
|
|
75
|
+
|
|
76
|
+
const getScreenAspectRatio = () => {
|
|
77
|
+
const longEdge = Math.max(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
78
|
+
const shortEdge = Math.min(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
79
|
+
|
|
80
|
+
return longEdge / shortEdge;
|
|
81
|
+
};
|
|
82
|
+
|
|
68
83
|
export default class VideoPlayer extends React.Component<
|
|
69
84
|
QuickBrickPlayer.PlayerProps,
|
|
70
85
|
QuickBrickPlayer.NativePlayerState
|
|
@@ -971,120 +986,162 @@ export default class VideoPlayer extends React.Component<
|
|
|
971
986
|
pip: this.state.piped,
|
|
972
987
|
},
|
|
973
988
|
configuration: this.getPluginConfiguration(),
|
|
974
|
-
|
|
975
|
-
isTabletPortrait: isTabletPortrait,
|
|
989
|
+
isTabletPortrait,
|
|
976
990
|
playNextData: this.getPlayNextData(),
|
|
977
991
|
};
|
|
978
992
|
|
|
979
|
-
const containerStyle = { flex: 1 };
|
|
980
|
-
|
|
981
993
|
const backgroundImageKey =
|
|
982
994
|
this.getPluginConfiguration()?.player_preview_image_key;
|
|
983
995
|
|
|
984
996
|
const shouldRenderNativePlayer =
|
|
985
997
|
!this.props.isCasting || this.supportNativeCast;
|
|
986
998
|
|
|
999
|
+
const aspectRatio =
|
|
1000
|
+
!inline && isModal && !this.state.piped ? getScreenAspectRatio() : 16 / 9;
|
|
1001
|
+
|
|
987
1002
|
const renderMobilePlayer = () => {
|
|
988
1003
|
return isFullScreenAudioPlayer && isAudioItem ? (
|
|
989
1004
|
// Ensure the View remains in the native hierarchy for proper rendering and interaction
|
|
990
|
-
<
|
|
991
|
-
{
|
|
992
|
-
<
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1005
|
+
<PlayerModal
|
|
1006
|
+
content={
|
|
1007
|
+
<View collapsable={false} style={styles.container}>
|
|
1008
|
+
{shouldRenderNativePlayer ? (
|
|
1009
|
+
<this.props.PlayerComponent
|
|
1010
|
+
ref={this._assignRoot}
|
|
1011
|
+
{...nativeEvents}
|
|
1012
|
+
{...nativeProps}
|
|
1013
|
+
listener={this.props.listener}
|
|
1014
|
+
/>
|
|
1015
|
+
) : null}
|
|
1016
|
+
<AudioPlayerWrapper {...sharedWrapperViewProps} />
|
|
1017
|
+
</View>
|
|
1018
|
+
}
|
|
1019
|
+
collapsedContent={
|
|
1020
|
+
<View style={styles.container}>
|
|
1021
|
+
<DockedControls
|
|
1022
|
+
entry={entry}
|
|
1023
|
+
aspectRatio={1}
|
|
1024
|
+
layoutState={sharedWrapperViewProps.layoutState}
|
|
1025
|
+
playNextData={sharedWrapperViewProps.playNextData}
|
|
1026
|
+
ImageComponent={
|
|
1027
|
+
<FlexImage entry={entry} style={styles.flexImage} />
|
|
1028
|
+
}
|
|
1029
|
+
/>
|
|
1030
|
+
</View>
|
|
1031
|
+
}
|
|
1032
|
+
/>
|
|
1001
1033
|
) : (
|
|
1002
|
-
<
|
|
1003
|
-
{
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1034
|
+
<VideoPlayerModal
|
|
1035
|
+
enabled={!!isModal && !fullscreen}
|
|
1036
|
+
isTabletPortrait={isTabletPortrait}
|
|
1037
|
+
aspectRatio={aspectRatio}
|
|
1038
|
+
pip={this.state.piped}
|
|
1039
|
+
style={{
|
|
1040
|
+
tabletLandscapeWidth: getTabletWidth(
|
|
1041
|
+
this.getPluginConfiguration().tablet_landscape_sidebar_width,
|
|
1042
|
+
style
|
|
1043
|
+
),
|
|
1044
|
+
width: style.width,
|
|
1045
|
+
height: style.height,
|
|
1046
|
+
}}
|
|
1047
|
+
content={(_opacityAnim) => (
|
|
1048
|
+
<PlayerWrapper
|
|
1049
|
+
{...sharedWrapperViewProps}
|
|
1050
|
+
playerContent={(playerDimensions) => {
|
|
1051
|
+
const shouldRenderBackground =
|
|
1052
|
+
!R.isNil(backgroundImageKey) &&
|
|
1053
|
+
backgroundImageKey.length > 0 &&
|
|
1054
|
+
!this.onVideoLoadCalled &&
|
|
1055
|
+
!this.state.isAd;
|
|
1056
|
+
|
|
1057
|
+
return (
|
|
1058
|
+
<View style={styles.container}>
|
|
1059
|
+
<View style={[playerContainerStyles, playerDimensions]}>
|
|
1060
|
+
{isAudioItem ? (
|
|
1061
|
+
<AudioPlayer
|
|
1062
|
+
style={
|
|
1063
|
+
isTV()
|
|
1064
|
+
? getStyle(playerDimensions)
|
|
1065
|
+
: styles.playerSize
|
|
1066
|
+
}
|
|
1067
|
+
audio_item={entry}
|
|
1068
|
+
plugin_configuration={this.getPluginConfiguration()}
|
|
1069
|
+
/>
|
|
1070
|
+
) : null}
|
|
1071
|
+
|
|
1072
|
+
{shouldRenderBackground ? (
|
|
1073
|
+
<PlayerImageBackground
|
|
1074
|
+
imageKey={backgroundImageKey}
|
|
1075
|
+
configuration={this.getPluginConfiguration()}
|
|
1076
|
+
entry={entry}
|
|
1077
|
+
style={getBackgroundImageStyle(playerDimensions)}
|
|
1078
|
+
/>
|
|
1079
|
+
) : null}
|
|
1080
|
+
|
|
1081
|
+
{shouldRenderNativePlayer ? (
|
|
1082
|
+
<View style={getStyle(playerDimensions)}>
|
|
1083
|
+
<this.props.PlayerComponent
|
|
1084
|
+
ref={this._assignRoot}
|
|
1085
|
+
{...nativeEvents}
|
|
1086
|
+
{...nativeProps}
|
|
1087
|
+
listener={this.props.listener}
|
|
1088
|
+
style={
|
|
1089
|
+
isTV()
|
|
1090
|
+
? getStyle(playerDimensions)
|
|
1091
|
+
: styles.playerSize
|
|
1092
|
+
}
|
|
1093
|
+
pluginConfiguration={this.getPluginConfiguration()}
|
|
1094
|
+
controller={this.props.controller}
|
|
1095
|
+
>
|
|
1096
|
+
{this.props.children}
|
|
1097
|
+
</this.props.PlayerComponent>
|
|
1098
|
+
</View>
|
|
1099
|
+
) : null}
|
|
1100
|
+
</View>
|
|
1101
|
+
|
|
1102
|
+
{renderTransportControls(playerDimensions)}
|
|
1103
|
+
{!this.state.piped && (
|
|
1104
|
+
<PlayNextOverlay
|
|
1105
|
+
item={entry}
|
|
1106
|
+
playerIsDocked={docked}
|
|
1107
|
+
pluginConfiguration={this.getPluginConfiguration()}
|
|
1108
|
+
playerId={this.props.playerId}
|
|
1109
|
+
playNextData={this.getPlayNextData()}
|
|
1110
|
+
setNextVideoPreloadThresholdPercentage={
|
|
1111
|
+
this.props.setNextVideoPreloadThresholdPercentage
|
|
1027
1112
|
}
|
|
1028
|
-
audio_item={entry}
|
|
1029
|
-
plugin_configuration={this.getPluginConfiguration()}
|
|
1030
1113
|
/>
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
isTV()
|
|
1059
|
-
? getStyle(playerDimensions)
|
|
1060
|
-
: styles.playerSize
|
|
1061
|
-
}
|
|
1062
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1063
|
-
controller={this.props.controller}
|
|
1064
|
-
>
|
|
1065
|
-
{this.props.children}
|
|
1066
|
-
</this.props.PlayerComponent>
|
|
1067
|
-
</AnimationComponent>
|
|
1068
|
-
) : null}
|
|
1069
|
-
</View>
|
|
1070
|
-
|
|
1071
|
-
{renderTransportControls(playerDimensions)}
|
|
1072
|
-
{!this.state.piped && (
|
|
1073
|
-
<PlayNextOverlay
|
|
1074
|
-
item={entry}
|
|
1075
|
-
playerIsDocked={docked}
|
|
1076
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1077
|
-
playerId={this.props.playerId}
|
|
1078
|
-
playNextData={this.getPlayNextData()}
|
|
1079
|
-
setNextVideoPreloadThresholdPercentage={
|
|
1080
|
-
this.props.setNextVideoPreloadThresholdPercentage
|
|
1081
|
-
}
|
|
1082
|
-
/>
|
|
1083
|
-
)}
|
|
1114
|
+
)}
|
|
1115
|
+
</View>
|
|
1116
|
+
);
|
|
1117
|
+
}}
|
|
1118
|
+
/>
|
|
1119
|
+
)}
|
|
1120
|
+
extraContent={(_opacityAnim) => (
|
|
1121
|
+
<PlayerDetails
|
|
1122
|
+
configuration={this.getPluginConfiguration()}
|
|
1123
|
+
style={{ flex: 1 }}
|
|
1124
|
+
entry={entry}
|
|
1125
|
+
isTabletLandscape={!isTabletPortrait}
|
|
1126
|
+
inline={inline}
|
|
1127
|
+
docked={docked}
|
|
1128
|
+
isModal={isModal}
|
|
1129
|
+
pip={this.state.piped}
|
|
1130
|
+
/>
|
|
1131
|
+
)}
|
|
1132
|
+
collapsedContent={(_opacityAnim) =>
|
|
1133
|
+
this.state.piped ? null : (
|
|
1134
|
+
<View style={styles.container}>
|
|
1135
|
+
<DockedControls
|
|
1136
|
+
entry={entry}
|
|
1137
|
+
aspectRatio={aspectRatio}
|
|
1138
|
+
layoutState={sharedWrapperViewProps.layoutState}
|
|
1139
|
+
playNextData={sharedWrapperViewProps.playNextData}
|
|
1140
|
+
/>
|
|
1084
1141
|
</View>
|
|
1085
|
-
)
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1142
|
+
)
|
|
1143
|
+
}
|
|
1144
|
+
/>
|
|
1088
1145
|
);
|
|
1089
1146
|
};
|
|
1090
1147
|
|