@cometchat/calls-sdk-react-native 5.0.3 → 5.0.4

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.
@@ -0,0 +1,65 @@
1
+ #import <AVFoundation/AVFoundation.h>
2
+ #import <Foundation/Foundation.h>
3
+
4
+ #import <React/RCTBridgeModule.h>
5
+
6
+ #import <WebRTCModuleOptions.h>
7
+
8
+ /**
9
+ * Opts every camera capture session react-native-webrtc creates into
10
+ * multitasking camera access, and reports to JS whether iOS actually grants it.
11
+ *
12
+ * Without it iOS interrupts capture
13
+ * (AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps)
14
+ * as soon as the app stops being the sole full-screen foreground app — which
15
+ * includes entering system Picture in Picture — and the local camera freezes on
16
+ * its last frame for everyone else in the call.
17
+ *
18
+ * react-native-webrtc reads the flag when it builds each VideoCaptureController
19
+ * and applies it in -startCapture, but only after checking
20
+ * AVCaptureSession.isMultitaskingCameraAccessSupported, so leaving it on is a
21
+ * no-op where the OS or device does not allow it. Support is limited to iPads
22
+ * that run Stage Manager before iOS 18; from iOS 18 it also covers
23
+ * video-conferencing apps that declare `voip` in UIBackgroundModes, which
24
+ * Info.plist already does.
25
+ */
26
+ /**
27
+ * Set at image load, so the flag is in place before any getUserMedia call — the
28
+ * capture session only reads it when the capture starts, so setting it later
29
+ * would not affect tracks that are already running. A constructor rather than a
30
+ * +load because RCT_EXPORT_MODULE already defines +load on this class.
31
+ */
32
+ __attribute__((constructor)) static void CometChatEnableMultitaskingCameraAccess(void) {
33
+ [WebRTCModuleOptions sharedInstance].enableMultitaskingCameraAccess = YES;
34
+ }
35
+
36
+ @interface MultitaskingCameraModule : NSObject <RCTBridgeModule>
37
+ @end
38
+
39
+ @implementation MultitaskingCameraModule
40
+
41
+ RCT_EXPORT_MODULE(MultitaskingCamera);
42
+
43
+ + (BOOL)requiresMainQueueSetup {
44
+ return NO;
45
+ }
46
+
47
+ /**
48
+ * Asked of a throwaway session on purpose: the answer turns on the device, the
49
+ * OS version and this app's own linkage and background modes, not on how a
50
+ * particular session is configured. Allocating a session neither touches the
51
+ * camera nor triggers the permission prompt.
52
+ */
53
+ + (BOOL)isSupported {
54
+ if (@available(iOS 16.0, *)) {
55
+ return [[AVCaptureSession alloc] init].isMultitaskingCameraAccessSupported;
56
+ }
57
+
58
+ return NO;
59
+ }
60
+
61
+ - (NSDictionary *)constantsToExport {
62
+ return @{@"isSupported" : @([MultitaskingCameraModule isSupported])};
63
+ }
64
+
65
+ @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/calls-sdk-react-native",
3
- "version": "5.0.3",
3
+ "version": "5.0.4",
4
4
  "description": "CometChat Calls SDK for React Native provides voice and video calling capabilities for React Native applications.",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -23,7 +23,34 @@
23
23
  "zustand": "^5.0.4"
24
24
  },
25
25
  "devDependencies": {},
26
- "peerDependencies": {},
26
+ "peerDependencies": {
27
+ "@react-native-async-storage/async-storage": "^2.1.2",
28
+ "react-native-background-timer": "^2.4.1",
29
+ "react-native-performance": "^5.1.2",
30
+ "react-native-svg": "^15.12.0",
31
+ "react-native-url-polyfill": "^2.0.0",
32
+ "react-native-webrtc": "^124.0.7"
33
+ },
34
+ "peerDependenciesMeta": {
35
+ "@react-native-async-storage/async-storage": {
36
+ "optional": true
37
+ },
38
+ "react-native-background-timer": {
39
+ "optional": true
40
+ },
41
+ "react-native-performance": {
42
+ "optional": true
43
+ },
44
+ "react-native-svg": {
45
+ "optional": true
46
+ },
47
+ "react-native-url-polyfill": {
48
+ "optional": true
49
+ },
50
+ "react-native-webrtc": {
51
+ "optional": true
52
+ }
53
+ },
27
54
  "engines": {
28
55
  "node": ">=18"
29
56
  },