@applicaster/quick-brick-player 15.0.0-rc.142 → 15.0.0-rc.144

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": "15.0.0-rc.142",
3
+ "version": "15.0.0-rc.144",
4
4
  "description": "Quick Brick Player",
5
5
  "main": "./src/index.ts",
6
6
  "types": "index.d.ts",
@@ -35,11 +35,11 @@
35
35
  },
36
36
  "homepage": "https://github.com/applicaster/quickbrick#readme",
37
37
  "dependencies": {
38
- "@applicaster/quick-brick-mobile-transport-controls": "15.0.0-rc.127",
38
+ "@applicaster/quick-brick-mobile-transport-controls": "15.0.0-rc.143",
39
39
  "@applicaster/quick-brick-tv-transport-controls": "15.0.0-rc.142",
40
- "@applicaster/zapp-react-native-tvos-app": "15.0.0-rc.142",
41
- "@applicaster/zapp-react-native-ui-components": "15.0.0-rc.142",
42
- "@applicaster/zapp-react-native-utils": "15.0.0-rc.142",
40
+ "@applicaster/zapp-react-native-tvos-app": "15.0.0-rc.144",
41
+ "@applicaster/zapp-react-native-ui-components": "15.0.0-rc.144",
42
+ "@applicaster/zapp-react-native-utils": "15.0.0-rc.144",
43
43
  "query-string": "7.1.3",
44
44
  "shaka-player": "4.3.5",
45
45
  "typeface-montserrat": "^0.0.54",
@@ -7,7 +7,7 @@ import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/acti
7
7
  import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
8
8
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
9
9
  import { usePlayerTTS } from "@applicaster/zapp-react-native-utils/playerUtils/usePlayerTTS";
10
- import { useIsCasting } from "./Player/hooks/useIsCasting";
10
+ import { useIsCasting } from "@applicaster/zapp-react-native-utils/reactHooks/casting";
11
11
 
12
12
  const CHROMECAST_IDENTIFIER = "quick-brick-chromecast-action";
13
13
 
@@ -1,57 +0,0 @@
1
- import React from "react";
2
- import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
3
- import { useAppState } from "@applicaster/zapp-react-native-utils/reactHooks/app";
4
- import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
5
-
6
- const CHROMECAST_IDENTIFIER = "quick-brick-chromecast-action";
7
-
8
- const fakeEntry: any = {
9
- title: "Chromecast use is casting fake entry",
10
- id: "quick-brick-use-is-casting-fake-entry",
11
- };
12
-
13
- /**
14
- * Returns the cast action state connection status, does not update when app is in background on Apple platforms
15
- * On other platforms, it continues to check the cast action state even when the app is in background
16
- */
17
- export const useIsCasting = () => {
18
- const actionContext = useActions(CHROMECAST_IDENTIFIER);
19
- const appState = useAppState();
20
- const isAppInForeground = appState === "active";
21
- const shouldOnlyUpdateInForeground = isApplePlatform();
22
-
23
- const [castActionState, setCastActionState] = React.useState(
24
- !actionContext ? null : actionContext.initialEntryState(fakeEntry)
25
- );
26
-
27
- React.useEffect(() => {
28
- if (!shouldOnlyUpdateInForeground || isAppInForeground) {
29
- if (actionContext && castActionState === null) {
30
- setCastActionState(actionContext.initialEntryState(fakeEntry));
31
- }
32
- }
33
- }, [
34
- actionContext,
35
- setCastActionState,
36
- isAppInForeground,
37
- shouldOnlyUpdateInForeground,
38
- ]);
39
-
40
- React.useEffect(() => {
41
- if (typeof actionContext?.addListener === "function") {
42
- return actionContext?.addListener(String(fakeEntry.id), (state) => {
43
- // Only check foreground state on Apple platforms
44
- if (!shouldOnlyUpdateInForeground || isAppInForeground) {
45
- setCastActionState(state);
46
- }
47
- });
48
- }
49
- }, [
50
- setCastActionState,
51
- actionContext,
52
- isAppInForeground,
53
- shouldOnlyUpdateInForeground,
54
- ]);
55
-
56
- return !!castActionState?.connected;
57
- };