@applicaster/quick-brick-player 14.0.0-alpha.1430213104 → 14.0.0-alpha.1615413083

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-player",
3
- "version": "14.0.0-alpha.1430213104",
3
+ "version": "14.0.0-alpha.1615413083",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -36,10 +36,10 @@
36
36
  "homepage": "https://github.com/applicaster/quickbrick#readme",
37
37
  "dependencies": {
38
38
  "@applicaster/quick-brick-mobile-transport-controls": "13.0.0-rc.124",
39
- "@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.3",
40
- "@applicaster/zapp-react-native-tvos-app": "14.0.0-alpha.1430213104",
41
- "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.1430213104",
42
- "@applicaster/zapp-react-native-utils": "14.0.0-alpha.1430213104",
39
+ "@applicaster/quick-brick-tv-transport-controls": "14.0.0-rc.7",
40
+ "@applicaster/zapp-react-native-tvos-app": "14.0.0-alpha.1615413083",
41
+ "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.1615413083",
42
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.1615413083",
43
43
  "query-string": "7.1.3",
44
44
  "react-native-web-linear-gradient": "1.1.2",
45
45
  "shaka-player": "4.3.5",
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { PlayNextOverlay } from "../PlayNextOverlay";
3
+ import { GenericTVPlayerViewProps } from "./types";
4
+ import { AudioPlayer } from "@applicaster/zapp-react-native-ui-components/Components/AudioPlayer";
5
+
6
+ export const GenericTVPlayerView: React.FC<GenericTVPlayerViewProps> = ({
7
+ children,
8
+ type,
9
+ PlayerComponent,
10
+ pluginConfiguration,
11
+ playerProps,
12
+ playNextProps,
13
+ audioPlayerProps,
14
+ transportControls,
15
+ entry,
16
+ inline,
17
+ }) => {
18
+ return (
19
+ <>
20
+ {type === "audio" && inline ? (
21
+ <AudioPlayer
22
+ audio_item={entry}
23
+ plugin_configuration={pluginConfiguration}
24
+ {...audioPlayerProps}
25
+ />
26
+ ) : null}
27
+ <PlayerComponent
28
+ pluginConfiguration={pluginConfiguration}
29
+ {...playerProps}
30
+ >
31
+ {children}
32
+ </PlayerComponent>
33
+ {transportControls}
34
+ {playNextProps.playNextData ? (
35
+ <PlayNextOverlay
36
+ item={entry}
37
+ pluginConfiguration={pluginConfiguration}
38
+ {...playNextProps}
39
+ />
40
+ ) : null}
41
+ </>
42
+ );
43
+ };
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { isTvOSPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
3
+ import { TvOSPlayerView } from "./TvOSPlayerView";
4
+ import { GenericTVPlayerView } from "./GenericTVPlayerView";
5
+ import {
6
+ GenericTVPlayerViewProps,
7
+ TvOSPlayerViewProps,
8
+ TVPlayerViewProps,
9
+ } from "./types";
10
+
11
+ const isTvOS = isTvOSPlatform();
12
+
13
+ export const TVPlayerView: React.FC<TVPlayerViewProps> = (props) => {
14
+ return isTvOS && !props.inline ? (
15
+ <TvOSPlayerView {...(props as TvOSPlayerViewProps)} />
16
+ ) : (
17
+ <GenericTVPlayerView {...(props as GenericTVPlayerViewProps)} />
18
+ );
19
+ };
@@ -0,0 +1,51 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { PlayNextOverlay } from "../PlayNextOverlay";
4
+ import { TvOSPlayerViewProps } from "./types";
5
+
6
+ const AUDIO_PLAYER_NATIVE_ID = "audio-player-view";
7
+
8
+ export const TvOSPlayerView: React.FC<TvOSPlayerViewProps> = ({
9
+ children,
10
+ type,
11
+ PlayerComponent,
12
+ pluginConfiguration,
13
+ playerProps,
14
+ playNextProps,
15
+ nativePlayerIsReady,
16
+ transportControls,
17
+ entry,
18
+ inline,
19
+ }) => {
20
+ return (
21
+ <>
22
+ <PlayerComponent
23
+ pluginConfiguration={pluginConfiguration}
24
+ {...playerProps}
25
+ >
26
+ {!inline ? (
27
+ <>
28
+ {type === "audio" && nativePlayerIsReady ? (
29
+ <View
30
+ nativeID={AUDIO_PLAYER_NATIVE_ID}
31
+ key={AUDIO_PLAYER_NATIVE_ID}
32
+ >
33
+ {children}
34
+ </View>
35
+ ) : (
36
+ children
37
+ )}
38
+ {playNextProps.playNextData ? (
39
+ <PlayNextOverlay
40
+ item={entry}
41
+ pluginConfiguration={pluginConfiguration}
42
+ {...playNextProps}
43
+ />
44
+ ) : null}
45
+ </>
46
+ ) : null}
47
+ </PlayerComponent>
48
+ {transportControls}
49
+ </>
50
+ );
51
+ };
@@ -0,0 +1,39 @@
1
+ import { ReactNode, ComponentType } from "react";
2
+ import { PlayNextData } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainer";
3
+
4
+ export interface PlayNextOverlayProps {
5
+ playerIsDocked: boolean;
6
+ playerId?: string;
7
+ playNextData: PlayNextData;
8
+ setNextVideoPreloadThresholdPercentage: (percentage: number) => void;
9
+ }
10
+
11
+ export interface PlayerComponentProps {
12
+ [key: string]: any;
13
+ }
14
+
15
+ export interface AudioPlayerProps {
16
+ [key: string]: any;
17
+ }
18
+
19
+ export interface PlayerViewBaseProps {
20
+ children?: ReactNode;
21
+ type: "audio" | "video";
22
+ entry: ZappEntry;
23
+ pluginConfiguration: Record<string, any>;
24
+ PlayerComponent: ComponentType<any>;
25
+ playerProps: PlayerComponentProps;
26
+ playNextProps: PlayNextOverlayProps;
27
+ AudioPlayer: ComponentType<any>;
28
+ audioPlayerProps: AudioPlayerProps;
29
+ transportControls?: ReactNode;
30
+ inline?: boolean;
31
+ }
32
+
33
+ export interface TvOSPlayerViewProps extends PlayerViewBaseProps {
34
+ nativePlayerIsReady: boolean;
35
+ }
36
+
37
+ export type GenericTVPlayerViewProps = PlayerViewBaseProps;
38
+
39
+ export type TVPlayerViewProps = TvOSPlayerViewProps | GenericTVPlayerViewProps;
@@ -4,8 +4,6 @@
4
4
  import React from "react";
5
5
  import * as R from "ramda";
6
6
 
7
- import { flatten } from "@applicaster/zapp-react-native-utils/utils";
8
-
9
7
  import { findNodeHandle, StyleSheet, View } from "react-native";
10
8
  import TransportControlsMobile from "@applicaster/quick-brick-mobile-transport-controls";
11
9
  import TransportControlsTV from "@applicaster/quick-brick-tv-transport-controls";
@@ -46,6 +44,8 @@ import {
46
44
  isInlineTV as isInlineTVUtil,
47
45
  } from "@applicaster/zapp-react-native-utils/playerUtils";
48
46
 
47
+ import { TVPlayerView } from "./PlayerView/TVPlayerView";
48
+
49
49
  const styles = StyleSheet.create({
50
50
  container: { flex: 1 },
51
51
  playerContainerBlack: { backgroundColor: DEFAULT_COLORS.black },
@@ -55,7 +55,6 @@ const styles = StyleSheet.create({
55
55
  position: "absolute",
56
56
  zIndex: 1,
57
57
  },
58
- audioPlayerSize: { width: "100%", height: "100%" },
59
58
  playerSize: { width: "100%", height: "100%" },
60
59
  });
61
60
 
@@ -66,8 +65,6 @@ const logger = createLogger({
66
65
 
67
66
  const isTvOS = isTvOSPlatform();
68
67
 
69
- const AUDIO_PLAYER_NATIVE_ID = "audio-player-view";
70
-
71
68
  export default class VideoPlayer extends React.Component<
72
69
  QuickBrickPlayer.PlayerProps,
73
70
  QuickBrickPlayer.NativePlayerState
@@ -688,53 +685,6 @@ export default class VideoPlayer extends React.Component<
688
685
  }
689
686
  };
690
687
 
691
- childrenWithExtensions = () => {
692
- const { docked, entry, children } = this.props;
693
-
694
- if (!isTvOS) {
695
- return children;
696
- }
697
-
698
- const output = [];
699
-
700
- // audio-player
701
- if (isAudioItemUtil(entry)) {
702
- const { nativePlayerIsReady } = this.state;
703
-
704
- // we have to wait ready status of native player view, before showing audio_player
705
- if (nativePlayerIsReady) {
706
- output.push(
707
- <View nativeID={AUDIO_PLAYER_NATIVE_ID} key={AUDIO_PLAYER_NATIVE_ID}>
708
- {children}
709
- </View>
710
- );
711
- }
712
- } else {
713
- output.push(children);
714
- }
715
- // audio-player
716
-
717
- // play-next
718
- if (this.getPlayNextData()) {
719
- output.push(
720
- <PlayNextOverlay
721
- key="play-next-overlay"
722
- item={entry}
723
- playerIsDocked={docked}
724
- pluginConfiguration={this.getPluginConfiguration()}
725
- playerId={this.props.playerId}
726
- playNextData={this.getPlayNextData()}
727
- setNextVideoPreloadThresholdPercentage={
728
- this.props.setNextVideoPreloadThresholdPercentage
729
- }
730
- />
731
- );
732
- }
733
- // play-next
734
-
735
- return flatten(output); // prevent possible case with nested array
736
- };
737
-
738
688
  get supportNativeCast() {
739
689
  return this.props.controller.supportNativeCast();
740
690
  }
@@ -1141,39 +1091,32 @@ export default class VideoPlayer extends React.Component<
1141
1091
  const renderTVPlayer = () => {
1142
1092
  return (
1143
1093
  <View style={this.takeParentStyle} testID={"player-view"}>
1144
- {isAudioItem && (isInlineTV || !isTvOS) ? (
1145
- <AudioPlayer
1146
- style={getStyle(styles.audioPlayerSize)}
1147
- audio_item={entry}
1148
- plugin_configuration={this.getPluginConfiguration()}
1149
- />
1150
- ) : null}
1151
-
1152
- <this.props.PlayerComponent
1153
- ref={this._assignRoot}
1154
- {...nativeEvents}
1155
- {...nativeProps}
1156
- listener={this.props.listener}
1157
- style={this.takeParentStyle}
1094
+ <TVPlayerView
1095
+ type={isAudioItem ? "audio" : "video"}
1096
+ entry={entry}
1097
+ inline={isInlineTV}
1098
+ transportControls={renderTransportControls(this.takeParentStyle)}
1099
+ PlayerComponent={this.props.PlayerComponent}
1100
+ nativePlayerIsReady={this.state.nativePlayerIsReady}
1158
1101
  pluginConfiguration={this.getPluginConfiguration()}
1159
- controller={this.props.controller}
1102
+ playerProps={{
1103
+ ref: this._assignRoot,
1104
+ ...nativeEvents,
1105
+ ...nativeProps,
1106
+ listener: this.props.listener,
1107
+ style: this.takeParentStyle,
1108
+ controller: this.props.controller,
1109
+ }}
1110
+ playNextProps={{
1111
+ playerIsDocked: docked,
1112
+ playerId: this.props.playerId,
1113
+ playNextData: this.getPlayNextData(),
1114
+ setNextVideoPreloadThresholdPercentage:
1115
+ this.props.setNextVideoPreloadThresholdPercentage,
1116
+ }}
1160
1117
  >
1161
- {!isInlineTV && this.childrenWithExtensions()}
1162
- </this.props.PlayerComponent>
1163
-
1164
- {renderTransportControls(this.takeParentStyle)}
1165
- {!isTvOS && (
1166
- <PlayNextOverlay
1167
- item={entry}
1168
- playerIsDocked={docked}
1169
- pluginConfiguration={this.getPluginConfiguration()}
1170
- playerId={this.props.playerId}
1171
- playNextData={this.getPlayNextData()}
1172
- setNextVideoPreloadThresholdPercentage={
1173
- this.props.setNextVideoPreloadThresholdPercentage
1174
- }
1175
- />
1176
- )}
1118
+ {this.props.children}
1119
+ </TVPlayerView>
1177
1120
  </View>
1178
1121
  );
1179
1122
  };