@applicaster/quick-brick-player 12.0.0-rc.1 → 12.0.0-rc.100
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 +7 -6
- package/src/CellPlayer/Assets/AssetsComponent.tsx +61 -50
- package/src/CellPlayer/ContextProvider.tsx +50 -1
- package/src/Player/AudioLayer/AudioDescription.tsx +3 -3
- package/src/Player/AudioLayer/AudioPlayerWrapper.tsx +277 -58
- package/src/Player/AudioLayer/Layout/DefaultLayout.tsx +261 -72
- package/src/Player/AudioLayer/Layout/DockedLayout.tsx +84 -32
- package/src/Player/AudioLayer/Layout/defaultLayoutsConts.ts +32 -1
- package/src/Player/AudioLayer/Layout/index.tsx +9 -7
- package/src/Player/AudioLayer/MagicBG/index.tsx +96 -27
- package/src/Player/AudioLayer/utils.ts +33 -0
- package/src/Player/Utils/Utils.ts +26 -16
- package/src/Player/Utils/index.tsx +0 -2
- package/src/Player/index.tsx +130 -72
package/src/Player/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import * as R from "ramda";
|
|
6
6
|
|
|
7
|
-
import { findNodeHandle,
|
|
7
|
+
import { findNodeHandle, StyleSheet, View } from "react-native";
|
|
8
8
|
import TransportControlsMobile from "@applicaster/quick-brick-mobile-transport-controls";
|
|
9
9
|
import TransportControlsTV from "@applicaster/quick-brick-tv-transport-controls";
|
|
10
10
|
|
|
@@ -36,15 +36,13 @@ import { AudioPlayerWrapper } from "./AudioLayer/AudioPlayerWrapper";
|
|
|
36
36
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
37
37
|
import { getAllAccessibilityProps } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
38
38
|
import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
: NativeModules.QBKalturaPlayerModule,
|
|
47
|
-
};
|
|
39
|
+
import { getTargetScreenDataFromEntry } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
|
|
40
|
+
import { isAppleTV } from "@applicaster/zapp-react-native-ui-components/Helpers/Platform";
|
|
41
|
+
import {
|
|
42
|
+
AnimationComponent,
|
|
43
|
+
ComponentAnimationType,
|
|
44
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
45
|
+
import { RNPlayerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/nativePlayerManager";
|
|
48
46
|
|
|
49
47
|
const styles = StyleSheet.create({
|
|
50
48
|
container: { flex: 1 },
|
|
@@ -55,6 +53,7 @@ const styles = StyleSheet.create({
|
|
|
55
53
|
position: "absolute",
|
|
56
54
|
zIndex: 1,
|
|
57
55
|
},
|
|
56
|
+
playerSize: { width: "100%", height: "100%" },
|
|
58
57
|
});
|
|
59
58
|
|
|
60
59
|
const logger = createLogger({
|
|
@@ -87,7 +86,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
87
86
|
// TODO: Can be deleted, on controller logic
|
|
88
87
|
paused: false,
|
|
89
88
|
piped: false,
|
|
90
|
-
rate: 1,
|
|
89
|
+
rate: 1.0,
|
|
91
90
|
// TODO: Hack for analytics, must br removed
|
|
92
91
|
resume: null,
|
|
93
92
|
|
|
@@ -113,8 +112,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
componentWillUnmount() {
|
|
116
|
-
this.stopBackgroundPlayback();
|
|
117
|
-
|
|
118
115
|
this.playbackStarted = false;
|
|
119
116
|
this.handleAnalyticEvent(GENERAL_EVENT.session_end);
|
|
120
117
|
this.onPlayerClosed();
|
|
@@ -159,6 +156,11 @@ export default class VideoPlayer extends React.Component<
|
|
|
159
156
|
}
|
|
160
157
|
}
|
|
161
158
|
|
|
159
|
+
// For close button
|
|
160
|
+
public closeNativePlayer = () => {
|
|
161
|
+
this.stopBackgroundPlayback();
|
|
162
|
+
};
|
|
163
|
+
|
|
162
164
|
getPlayNextData = () => this.props.playNextData as PlayNextData;
|
|
163
165
|
|
|
164
166
|
/**
|
|
@@ -333,11 +335,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
333
335
|
}
|
|
334
336
|
};
|
|
335
337
|
|
|
336
|
-
|
|
337
|
-
* Sets either subtitle language, or audio language if we have a selected a new locale.
|
|
338
|
-
* If no locale is set it defaults to system language for audio, and leaves subtitles unaltered.
|
|
339
|
-
*/
|
|
340
|
-
setLanguage = (selected = null) => {
|
|
338
|
+
selectTrack = (selected) => {
|
|
341
339
|
const { trackType, id, language } = selected || {};
|
|
342
340
|
|
|
343
341
|
const isOff = language === "Off";
|
|
@@ -368,6 +366,10 @@ export default class VideoPlayer extends React.Component<
|
|
|
368
366
|
}
|
|
369
367
|
};
|
|
370
368
|
|
|
369
|
+
setPlaybackRate = (rate = 1.0) => {
|
|
370
|
+
this.setState({ rate });
|
|
371
|
+
};
|
|
372
|
+
|
|
371
373
|
getCurrentTime = () => {
|
|
372
374
|
return this.state.currentTime;
|
|
373
375
|
};
|
|
@@ -551,6 +553,26 @@ export default class VideoPlayer extends React.Component<
|
|
|
551
553
|
this.props.listener?.onPlayerDetached?.(nativeEvent);
|
|
552
554
|
};
|
|
553
555
|
|
|
556
|
+
onVideoFullscreenPlayerDidDismiss = () => {
|
|
557
|
+
this.props.listener?.onVideoFullscreenPlayerDidDismiss?.();
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
onVideoFullscreenPlayerDidPresent = () => {
|
|
561
|
+
this.props.listener?.onVideoFullscreenPlayerDidPresent?.();
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
onVideoFullscreenPlayerWillDismiss = () => {
|
|
565
|
+
this.props.listener?.onVideoFullscreenPlayerWillDismiss?.();
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
onVideoFullscreenPlayerWillPresent = () => {
|
|
569
|
+
this.props.listener?.onVideoFullscreenPlayerWillPresent?.();
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
onPlayerClose = () => {
|
|
573
|
+
this.props.listener?.onPlayerClose?.();
|
|
574
|
+
};
|
|
575
|
+
|
|
554
576
|
onPiPEnter = () => {
|
|
555
577
|
this.setState({ piped: true });
|
|
556
578
|
this.props.openPiP();
|
|
@@ -754,8 +776,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
754
776
|
|
|
755
777
|
render() {
|
|
756
778
|
const {
|
|
757
|
-
castAction,
|
|
758
|
-
controls,
|
|
759
779
|
docked,
|
|
760
780
|
entry,
|
|
761
781
|
fullscreen,
|
|
@@ -765,9 +785,15 @@ export default class VideoPlayer extends React.Component<
|
|
|
765
785
|
isTabletPortrait,
|
|
766
786
|
muted,
|
|
767
787
|
style,
|
|
788
|
+
castAction,
|
|
789
|
+
controller,
|
|
790
|
+
startComponentsAnimation,
|
|
768
791
|
} = this.props;
|
|
769
792
|
|
|
770
|
-
const
|
|
793
|
+
const supportNativeCast = controller.supportNativeCast();
|
|
794
|
+
|
|
795
|
+
const { audioTrackId, keyEvent, paused, seek, textTrackId, rate } =
|
|
796
|
+
this.state;
|
|
771
797
|
|
|
772
798
|
const isAudioItem =
|
|
773
799
|
entry?.content?.type?.includes?.("audio") ||
|
|
@@ -812,17 +838,35 @@ export default class VideoPlayer extends React.Component<
|
|
|
812
838
|
const liveCatchUpEnabled =
|
|
813
839
|
this.props.pluginConfiguration?.liveCatchUpEnabled;
|
|
814
840
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
841
|
+
// TODO: Get screen data more reliable way useCurrentScreenData
|
|
842
|
+
const screenData = getTargetScreenDataFromEntry(this.props.playableItem);
|
|
843
|
+
|
|
844
|
+
const isInlineTV = screenData?.ui_components?.length > 0 && isTV();
|
|
818
845
|
|
|
819
|
-
|
|
846
|
+
let platformSpecificProps: any = isApplePlatform()
|
|
820
847
|
? {
|
|
821
|
-
...hideNativeControls,
|
|
822
848
|
resizeMode: nativeResizeMode,
|
|
823
849
|
}
|
|
824
850
|
: {};
|
|
825
851
|
|
|
852
|
+
const supportsNativeControls =
|
|
853
|
+
!!this.props.controller?.supportsNativeControls?.();
|
|
854
|
+
|
|
855
|
+
const controls = isAppleTV()
|
|
856
|
+
? (supportsNativeControls && !isInlineTV) || !!this.getPlayNextData()
|
|
857
|
+
: supportsNativeControls && !this.getPlayNextData();
|
|
858
|
+
|
|
859
|
+
const shouldUseNativeControls =
|
|
860
|
+
controls &&
|
|
861
|
+
!startComponentsAnimation &&
|
|
862
|
+
!docked &&
|
|
863
|
+
!castAction?.state?.connected;
|
|
864
|
+
|
|
865
|
+
platformSpecificProps = {
|
|
866
|
+
...platformSpecificProps,
|
|
867
|
+
controls: shouldUseNativeControls,
|
|
868
|
+
};
|
|
869
|
+
|
|
826
870
|
const pictureInPictureEnabled =
|
|
827
871
|
this.props.pluginConfiguration?.pictureInPictureEnabled;
|
|
828
872
|
|
|
@@ -830,7 +874,6 @@ export default class VideoPlayer extends React.Component<
|
|
|
830
874
|
entry, // Must be passed first in list
|
|
831
875
|
...platformSpecificProps,
|
|
832
876
|
audioTrackId,
|
|
833
|
-
controls,
|
|
834
877
|
docked,
|
|
835
878
|
enableAutoAudioTrackSelection,
|
|
836
879
|
fullscreen, // TODO: Check fullscreen params not crash
|
|
@@ -839,6 +882,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
839
882
|
nowPlayingEnabled,
|
|
840
883
|
paused,
|
|
841
884
|
seek,
|
|
885
|
+
rate,
|
|
842
886
|
textTrackId,
|
|
843
887
|
liveSeekingEnabled,
|
|
844
888
|
liveCatchUpEnabled,
|
|
@@ -884,22 +928,17 @@ export default class VideoPlayer extends React.Component<
|
|
|
884
928
|
onVideoEnd: this.onVideoEnd, // complete
|
|
885
929
|
onVideoError: this.onVideoError, // error
|
|
886
930
|
onVideoProgress: this.onVideoProgress,
|
|
887
|
-
onVideoFullscreenPlayerDidDismiss: this.
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
onVideoFullscreenPlayerWillDismiss: this.unHandledEvent(
|
|
894
|
-
"onVideoFullscreenPlayerWillDismiss"
|
|
895
|
-
),
|
|
896
|
-
onVideoFullscreenPlayerWillPresent: this.unHandledEvent(
|
|
897
|
-
"onVideoFullscreenPlayerWillPresent"
|
|
898
|
-
),
|
|
931
|
+
onVideoFullscreenPlayerDidDismiss: this.onVideoFullscreenPlayerDidDismiss,
|
|
932
|
+
onVideoFullscreenPlayerDidPresent: this.onVideoFullscreenPlayerDidPresent,
|
|
933
|
+
onVideoFullscreenPlayerWillDismiss:
|
|
934
|
+
this.onVideoFullscreenPlayerWillDismiss,
|
|
935
|
+
onVideoFullscreenPlayerWillPresent:
|
|
936
|
+
this.onVideoFullscreenPlayerWillPresent,
|
|
899
937
|
onVideoLoad: this.onVideoLoad,
|
|
900
938
|
onVideoLoadStart: this.unHandledEvent("onVideoLoadStart"),
|
|
901
939
|
onVideoBuffer: this.onVideoBuffer,
|
|
902
940
|
onPlaybackStalled: this.onPlaybackStalled,
|
|
941
|
+
onPlayerClose: this.onPlayerClose,
|
|
903
942
|
onPlayerAttached: this.onPlayerAttached,
|
|
904
943
|
onPlayerDetached: this.onPlayerDetached,
|
|
905
944
|
};
|
|
@@ -950,7 +989,13 @@ export default class VideoPlayer extends React.Component<
|
|
|
950
989
|
...androidLifecyclePiPEvents,
|
|
951
990
|
};
|
|
952
991
|
|
|
953
|
-
const needToShowPlayNextOverlay =
|
|
992
|
+
const needToShowPlayNextOverlay =
|
|
993
|
+
isTV() && this.getPlayNextData() && !docked;
|
|
994
|
+
|
|
995
|
+
const needToShowDefaultControls = !(
|
|
996
|
+
(controls && !castAction?.state?.connected) ||
|
|
997
|
+
this.getPlayNextData()
|
|
998
|
+
);
|
|
954
999
|
|
|
955
1000
|
const playerContainerStyles = isApplePlatform()
|
|
956
1001
|
? styles.playerContainerBlack
|
|
@@ -973,7 +1018,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
973
1018
|
!needToShowPlayNextOverlay &&
|
|
974
1019
|
this.props.mode !== "PIP";
|
|
975
1020
|
|
|
976
|
-
if (
|
|
1021
|
+
if (shouldUseNativeControls) {
|
|
977
1022
|
return null;
|
|
978
1023
|
}
|
|
979
1024
|
|
|
@@ -992,6 +1037,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
992
1037
|
extraInfoText={castAction?.state?.friendlyStatus}
|
|
993
1038
|
controlsAlwaysVisible={castAction?.state?.connected}
|
|
994
1039
|
playNextData={this.getPlayNextData()}
|
|
1040
|
+
needToShowDefaultControls={needToShowDefaultControls}
|
|
995
1041
|
/>
|
|
996
1042
|
) : null;
|
|
997
1043
|
};
|
|
@@ -1005,10 +1051,12 @@ export default class VideoPlayer extends React.Component<
|
|
|
1005
1051
|
inline,
|
|
1006
1052
|
docked,
|
|
1007
1053
|
isModal,
|
|
1054
|
+
pip: this.state.piped,
|
|
1008
1055
|
layoutState: {
|
|
1009
1056
|
inline,
|
|
1010
1057
|
docked,
|
|
1011
1058
|
isModal,
|
|
1059
|
+
pip: this.state.piped,
|
|
1012
1060
|
},
|
|
1013
1061
|
configuration: this.getPluginConfiguration(),
|
|
1014
1062
|
fullscreen: fullscreen,
|
|
@@ -1024,29 +1072,14 @@ export default class VideoPlayer extends React.Component<
|
|
|
1024
1072
|
const renderMobilePlayer = () => {
|
|
1025
1073
|
return isFullScreenAudioPlayer && isAudioItem ? (
|
|
1026
1074
|
<View style={containerStyle}>
|
|
1027
|
-
{!castAction?.state?.connected && (
|
|
1075
|
+
{(!castAction?.state?.connected || supportNativeCast) && (
|
|
1028
1076
|
<this.props.PlayerComponent
|
|
1029
1077
|
ref={this._assignRoot}
|
|
1030
1078
|
{...nativeEvents}
|
|
1031
1079
|
{...nativeProps}
|
|
1032
1080
|
/>
|
|
1033
1081
|
)}
|
|
1034
|
-
<AudioPlayerWrapper {...sharedWrapperViewProps}
|
|
1035
|
-
<View>
|
|
1036
|
-
{
|
|
1037
|
-
<PlayNextOverlay
|
|
1038
|
-
item={entry}
|
|
1039
|
-
playerIsDocked={docked}
|
|
1040
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1041
|
-
playerId={this.props.playerId}
|
|
1042
|
-
playNextData={this.getPlayNextData()}
|
|
1043
|
-
setNextVideoPreloadThresholdPercentage={
|
|
1044
|
-
this.props.setNextVideoPreloadThresholdPercentage
|
|
1045
|
-
}
|
|
1046
|
-
/>
|
|
1047
|
-
}
|
|
1048
|
-
</View>
|
|
1049
|
-
</AudioPlayerWrapper>
|
|
1082
|
+
<AudioPlayerWrapper {...sharedWrapperViewProps} />
|
|
1050
1083
|
</View>
|
|
1051
1084
|
) : (
|
|
1052
1085
|
<PlayerWrapper {...sharedWrapperViewProps}>
|
|
@@ -1061,11 +1094,24 @@ export default class VideoPlayer extends React.Component<
|
|
|
1061
1094
|
<View style={styles.container}>
|
|
1062
1095
|
<View style={[playerContainerStyles, playerDimensions]}>
|
|
1063
1096
|
{isAudioItem && (
|
|
1064
|
-
<
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1097
|
+
<AnimationComponent
|
|
1098
|
+
animationType={ComponentAnimationType.player}
|
|
1099
|
+
additionalData={{
|
|
1100
|
+
...playerDimensions,
|
|
1101
|
+
inlineAudioPlayer: true,
|
|
1102
|
+
}}
|
|
1103
|
+
style={getStyle(playerDimensions)}
|
|
1104
|
+
>
|
|
1105
|
+
<AudioPlayer
|
|
1106
|
+
style={
|
|
1107
|
+
isTV()
|
|
1108
|
+
? getStyle(playerDimensions)
|
|
1109
|
+
: styles.playerSize
|
|
1110
|
+
}
|
|
1111
|
+
audio_item={entry}
|
|
1112
|
+
plugin_configuration={this.getPluginConfiguration()}
|
|
1113
|
+
/>
|
|
1114
|
+
</AnimationComponent>
|
|
1069
1115
|
)}
|
|
1070
1116
|
|
|
1071
1117
|
{shouldRenderBackground && (
|
|
@@ -1077,17 +1123,28 @@ export default class VideoPlayer extends React.Component<
|
|
|
1077
1123
|
/>
|
|
1078
1124
|
)}
|
|
1079
1125
|
|
|
1080
|
-
{!castAction?.state?.connected && (
|
|
1081
|
-
<
|
|
1082
|
-
|
|
1083
|
-
{
|
|
1084
|
-
{...nativeProps}
|
|
1085
|
-
listener={this.props.listener}
|
|
1126
|
+
{(!castAction?.state?.connected || supportNativeCast) && (
|
|
1127
|
+
<AnimationComponent
|
|
1128
|
+
animationType={ComponentAnimationType.player}
|
|
1129
|
+
additionalData={playerDimensions}
|
|
1086
1130
|
style={getStyle(playerDimensions)}
|
|
1087
|
-
pluginConfiguration={this.getPluginConfiguration()}
|
|
1088
1131
|
>
|
|
1089
|
-
|
|
1090
|
-
|
|
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.childrenWithPlayNext()}
|
|
1146
|
+
</this.props.PlayerComponent>
|
|
1147
|
+
</AnimationComponent>
|
|
1091
1148
|
)}
|
|
1092
1149
|
</View>
|
|
1093
1150
|
|
|
@@ -1121,6 +1178,7 @@ export default class VideoPlayer extends React.Component<
|
|
|
1121
1178
|
listener={this.props.listener}
|
|
1122
1179
|
style={this.takeParentStyle}
|
|
1123
1180
|
pluginConfiguration={this.getPluginConfiguration()}
|
|
1181
|
+
controller={this.props.controller}
|
|
1124
1182
|
>
|
|
1125
1183
|
{this.childrenWithPlayNext()}
|
|
1126
1184
|
</this.props.PlayerComponent>
|