@applicaster/quick-brick-player 13.0.0-rc.129 → 13.0.0-rc.130

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": "13.0.0-rc.129",
3
+ "version": "13.0.0-rc.130",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -37,9 +37,9 @@
37
37
  "dependencies": {
38
38
  "@applicaster/quick-brick-mobile-transport-controls": "13.0.0-rc.124",
39
39
  "@applicaster/quick-brick-tv-transport-controls": "13.0.0-rc.56",
40
- "@applicaster/zapp-react-native-tvos-app": "13.0.0-rc.129",
41
- "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.129",
42
- "@applicaster/zapp-react-native-utils": "13.0.0-rc.129",
40
+ "@applicaster/zapp-react-native-tvos-app": "13.0.0-rc.130",
41
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-rc.130",
42
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.130",
43
43
  "query-string": "7.1.3",
44
44
  "react-native-web-linear-gradient": "1.1.2",
45
45
  "shaka-player": "4.3.5",
@@ -4,6 +4,8 @@
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
+
7
9
  import { findNodeHandle, StyleSheet, View } from "react-native";
8
10
  import TransportControlsMobile from "@applicaster/quick-brick-mobile-transport-controls";
9
11
  import TransportControlsTV from "@applicaster/quick-brick-tv-transport-controls";
@@ -40,6 +42,7 @@ import { PlayerAnalyticsManager } from "@applicaster/zapp-react-native-utils/ana
40
42
  import { PlayerAnalyticsTrackerI } from "@applicaster/zapp-react-native-utils/analyticsUtils/playerAnalyticsTracker";
41
43
 
42
44
  import { RNPlayerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/nativePlayerManager";
45
+ import { isAudioItem as isAudioItemUtil } from "@applicaster/zapp-react-native-utils/playerUtils";
43
46
 
44
47
  const styles = StyleSheet.create({
45
48
  container: { flex: 1 },
@@ -683,56 +686,51 @@ export default class VideoPlayer extends React.Component<
683
686
  }
684
687
  };
685
688
 
686
- childrenWithPlayNext = () => {
687
- if (!isTvOS || !this.getPlayNextData()) {
688
- return this.props.children;
689
- }
689
+ childrenWithExtensions = () => {
690
+ const { docked, entry, children } = this.props;
690
691
 
691
- // tvos only
692
- const { docked, entry } = this.props;
693
-
694
- const children = R.pathOr([], "children", this.props);
695
-
696
- return [
697
- ...children,
698
- <PlayNextOverlay
699
- key="play-next-overlay"
700
- item={entry}
701
- playerIsDocked={docked}
702
- pluginConfiguration={this.getPluginConfiguration()}
703
- playerId={this.props.playerId}
704
- playNextData={this.getPlayNextData()}
705
- setNextVideoPreloadThresholdPercentage={
706
- this.props.setNextVideoPreloadThresholdPercentage
707
- }
708
- />,
709
- ];
710
- };
711
-
712
- childrenWithAudioPlayer = () => {
713
692
  if (!isTvOS) {
714
- return this.props.children;
693
+ return children;
715
694
  }
716
695
 
717
- const { nativePlayerIsReady } = this.state;
718
-
719
- // we have to wait ready status of native player view, before showing audio_player
720
- if (!nativePlayerIsReady) {
721
- return this.props.children;
722
- }
696
+ const output = [];
723
697
 
724
- const { entry, children = [] } = this.props;
698
+ // audio-player
699
+ if (isAudioItemUtil(entry)) {
700
+ const { nativePlayerIsReady } = this.state;
725
701
 
726
- return [
727
- ...children,
728
- <View nativeID={AUDIO_PLAYER_NATIVE_ID} key={AUDIO_PLAYER_NATIVE_ID}>
729
- <AudioPlayer
730
- style={styles.audioPlayerSize}
731
- audio_item={entry}
732
- plugin_configuration={this.getPluginConfiguration()}
702
+ // we have to wait ready status of native player view, before showing audio_player
703
+ if (nativePlayerIsReady) {
704
+ output.push(
705
+ <View nativeID={AUDIO_PLAYER_NATIVE_ID} key={AUDIO_PLAYER_NATIVE_ID}>
706
+ {children}
707
+ </View>
708
+ );
709
+ }
710
+ } else {
711
+ output.push(children);
712
+ }
713
+ // audio-player
714
+
715
+ // play-next
716
+ if (this.getPlayNextData()) {
717
+ output.push(
718
+ <PlayNextOverlay
719
+ key="play-next-overlay"
720
+ item={entry}
721
+ playerIsDocked={docked}
722
+ pluginConfiguration={this.getPluginConfiguration()}
723
+ playerId={this.props.playerId}
724
+ playNextData={this.getPlayNextData()}
725
+ setNextVideoPreloadThresholdPercentage={
726
+ this.props.setNextVideoPreloadThresholdPercentage
727
+ }
733
728
  />
734
- </View>,
735
- ];
729
+ );
730
+ }
731
+ // play-next
732
+
733
+ return flatten(output); // prevent possible case with nested array
736
734
  };
737
735
 
738
736
  get supportNativeCast() {
@@ -757,10 +755,7 @@ export default class VideoPlayer extends React.Component<
757
755
  const { audioTrackId, keyEvent, paused, seek, textTrackId, rate } =
758
756
  this.state;
759
757
 
760
- const isAudioItem =
761
- entry?.content?.type?.includes?.("audio") ||
762
- entry?.type?.value?.includes?.("audio") ||
763
- entry?.content?.src?.includes?.("type=audio");
758
+ const isAudioItem = isAudioItemUtil(entry);
764
759
 
765
760
  const getStyle = (dimensions) => {
766
761
  const generalStyles = isAudioItem ? styles.audio : styles.video;
@@ -1115,7 +1110,7 @@ export default class VideoPlayer extends React.Component<
1115
1110
  pluginConfiguration={this.getPluginConfiguration()}
1116
1111
  controller={this.props.controller}
1117
1112
  >
1118
- {this.childrenWithPlayNext()}
1113
+ {this.props.children}
1119
1114
  </this.props.PlayerComponent>
1120
1115
  </AnimationComponent>
1121
1116
  ) : null}
@@ -1161,8 +1156,7 @@ export default class VideoPlayer extends React.Component<
1161
1156
  pluginConfiguration={this.getPluginConfiguration()}
1162
1157
  controller={this.props.controller}
1163
1158
  >
1164
- {this.childrenWithAudioPlayer()}
1165
- {this.childrenWithPlayNext()}
1159
+ {this.childrenWithExtensions()}
1166
1160
  </this.props.PlayerComponent>
1167
1161
 
1168
1162
  {renderTransportControls(this.takeParentStyle)}