@applicaster/zapp-react-native-utils 11.1.0 → 12.0.0-alpha.5035843303

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.
@@ -7,6 +7,7 @@ export enum SharedPlayerCallBacksKeys {
7
7
  OnPlayerPause = "onPlayerPause",
8
8
  OnLoad = "onLoad",
9
9
  OnError = "onError",
10
+ OnVideoError = "onVideoError",
10
11
  OnVideoEnd = "onVideoEnd",
11
12
  OnPlaybackRateChange = "onPlaybackRateChange",
12
13
  OnVideoLoad = "onVideoLoad",
@@ -355,6 +355,13 @@ export class Player {
355
355
  });
356
356
  };
357
357
 
358
+ onVideoError = (error: Error) => {
359
+ this.invokeListenersUpdate({
360
+ callbackName: SharedPlayerCallBacksKeys.OnVideoError,
361
+ event: error,
362
+ });
363
+ };
364
+
358
365
  onError = (error: Error) => {
359
366
  this.invokeListenersUpdate({
360
367
  callbackName: SharedPlayerCallBacksKeys.OnError,
@@ -620,6 +627,7 @@ export class Player {
620
627
  onPlayerSeekComplete: this.onSeekComplete,
621
628
  onVideoEnd: this.onVideoEnd,
622
629
  onError: this.onError,
630
+ onVideoError: this.onVideoError,
623
631
  onLoad: this.onLoad,
624
632
  onPlayerPause: this.onPlayerPause,
625
633
  onPlayerResume: this.onPlayerResume,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "11.1.0",
3
+ "version": "12.0.0-alpha.5035843303",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "11.1.0",
31
+ "@applicaster/applicaster-types": "12.0.0-alpha.5035843303",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { DeviceEventEmitter, NativeModules, Platform } from "react-native";
3
+ import { PushTopicManager } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
4
+
5
+ const { ReactNativeEventBusBridge } = NativeModules;
6
+
7
+ export const useListenEventBusEvent = (
8
+ subscriptionID: string, // subsciption ID to manage it, will be used as a event name for DeviceEventEmitter
9
+ source: string,
10
+ events: string[],
11
+ handler: (event) => void
12
+ ) => {
13
+ React.useEffect(() => {
14
+ let sub;
15
+
16
+ // TODO: remove after implementing ReactNativeEventBusBridge on iOS
17
+ if (Platform.OS === "android") {
18
+ // subscribe to DeviceEventEmitter using subsciption ID
19
+ sub = DeviceEventEmitter.addListener(
20
+ subscriptionID,
21
+ handler
22
+ );
23
+
24
+ // ask native to start routing these events to RN
25
+ ReactNativeEventBusBridge.subscribe(subscriptionID, { [source]: events });
26
+ }
27
+
28
+ // getting tags right after subscription
29
+ PushTopicManager.getInstance().prepareTags();
30
+
31
+ return () => {
32
+ ReactNativeEventBusBridge?.unsubscribe?.(subscriptionID); // ask EventBus to stop routing these events to RN
33
+ sub?.remove?.(); // stop listening to DeviceEventEmitter
34
+ };
35
+ }, []);
36
+ };