react-native-webrtc 124.0.3 → 124.0.5

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.
Files changed (91) hide show
  1. package/android/build.gradle +2 -1
  2. package/android/consumer-rules.pro +2 -0
  3. package/android/src/main/AndroidManifest.xml +0 -5
  4. package/android/src/main/java/com/oney/WebRTCModule/AbstractVideoCaptureController.java +43 -10
  5. package/android/src/main/java/com/oney/WebRTCModule/CameraCaptureController.java +210 -66
  6. package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +23 -8
  7. package/android/src/main/java/com/oney/WebRTCModule/ScreenCaptureController.java +5 -0
  8. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +4 -2
  9. package/android/src/main/java/org/webrtc/Camera1Helper.java +55 -0
  10. package/android/src/main/java/org/webrtc/Camera2Helper.java +51 -0
  11. package/ios/RCTWebRTC/CaptureController.h +3 -0
  12. package/ios/RCTWebRTC/CaptureController.m +13 -0
  13. package/ios/RCTWebRTC/I420Converter.h +21 -0
  14. package/ios/RCTWebRTC/I420Converter.m +156 -0
  15. package/ios/RCTWebRTC/PIPController.h +24 -0
  16. package/ios/RCTWebRTC/PIPController.m +242 -0
  17. package/ios/RCTWebRTC/RTCVideoViewManager.h +23 -0
  18. package/ios/RCTWebRTC/RTCVideoViewManager.m +105 -23
  19. package/ios/RCTWebRTC/SampleBufferVideoCallView.h +12 -0
  20. package/ios/RCTWebRTC/SampleBufferVideoCallView.m +180 -0
  21. package/ios/RCTWebRTC/ScreenCaptureController.m +8 -0
  22. package/ios/RCTWebRTC/VideoCaptureController.h +2 -0
  23. package/ios/RCTWebRTC/VideoCaptureController.m +96 -30
  24. package/ios/RCTWebRTC/WebRTCModule+RTCAudioSession.m +20 -0
  25. package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +47 -15
  26. package/ios/RCTWebRTC/WebRTCModuleOptions.h +1 -0
  27. package/ios/RCTWebRTC.xcodeproj/project.pbxproj +4 -0
  28. package/lib/commonjs/Constraints.js +2 -0
  29. package/lib/commonjs/Constraints.js.map +1 -0
  30. package/lib/commonjs/MediaDevices.js.map +1 -1
  31. package/lib/commonjs/MediaStreamTrack.js +26 -3
  32. package/lib/commonjs/MediaStreamTrack.js.map +1 -1
  33. package/lib/commonjs/RTCAudioSession.js +33 -0
  34. package/lib/commonjs/RTCAudioSession.js.map +1 -0
  35. package/lib/commonjs/RTCPIPView.js +42 -0
  36. package/lib/commonjs/RTCPIPView.js.map +1 -0
  37. package/lib/commonjs/RTCPeerConnection.js +5 -2
  38. package/lib/commonjs/RTCPeerConnection.js.map +1 -1
  39. package/lib/commonjs/RTCRtpParameters.js +4 -3
  40. package/lib/commonjs/RTCRtpParameters.js.map +1 -1
  41. package/lib/commonjs/RTCRtpSendParameters.js +2 -1
  42. package/lib/commonjs/RTCRtpSendParameters.js.map +1 -1
  43. package/lib/commonjs/RTCView.js.map +1 -1
  44. package/lib/commonjs/getUserMedia.js.map +1 -1
  45. package/lib/commonjs/index.js +28 -0
  46. package/lib/commonjs/index.js.map +1 -1
  47. package/lib/module/Constraints.js +2 -0
  48. package/lib/module/Constraints.js.map +1 -0
  49. package/lib/module/MediaDevices.js.map +1 -1
  50. package/lib/module/MediaStreamTrack.js +27 -4
  51. package/lib/module/MediaStreamTrack.js.map +1 -1
  52. package/lib/module/RTCAudioSession.js +26 -0
  53. package/lib/module/RTCAudioSession.js.map +1 -0
  54. package/lib/module/RTCPIPView.js +30 -0
  55. package/lib/module/RTCPIPView.js.map +1 -0
  56. package/lib/module/RTCPeerConnection.js +5 -2
  57. package/lib/module/RTCPeerConnection.js.map +1 -1
  58. package/lib/module/RTCRtpParameters.js +4 -3
  59. package/lib/module/RTCRtpParameters.js.map +1 -1
  60. package/lib/module/RTCRtpSendParameters.js +2 -1
  61. package/lib/module/RTCRtpSendParameters.js.map +1 -1
  62. package/lib/module/RTCView.js.map +1 -1
  63. package/lib/module/getUserMedia.js.map +1 -1
  64. package/lib/module/index.js +3 -1
  65. package/lib/module/index.js.map +1 -1
  66. package/lib/typescript/Constraints.d.ts +19 -0
  67. package/lib/typescript/MediaDevices.d.ts +2 -1
  68. package/lib/typescript/MediaStreamTrack.d.ts +26 -5
  69. package/lib/typescript/RTCAudioSession.d.ts +10 -0
  70. package/lib/typescript/RTCPIPView.d.ts +14 -0
  71. package/lib/typescript/RTCRtpParameters.d.ts +6 -2
  72. package/lib/typescript/RTCRtpSendParameters.d.ts +6 -2
  73. package/lib/typescript/RTCView.d.ts +44 -1
  74. package/lib/typescript/getUserMedia.d.ts +4 -4
  75. package/lib/typescript/index.d.ts +5 -3
  76. package/package.json +2 -1
  77. package/src/.eslintrc.cjs +1 -1
  78. package/src/Constraints.ts +21 -0
  79. package/src/MediaDevices.ts +2 -2
  80. package/src/MediaStreamTrack.ts +41 -7
  81. package/src/RTCAudioSession.ts +25 -0
  82. package/src/RTCPIPView.tsx +46 -0
  83. package/src/RTCPeerConnection.ts +6 -2
  84. package/src/RTCRtpParameters.ts +6 -5
  85. package/src/RTCRtpSendParameters.ts +5 -5
  86. package/src/RTCView.ts +50 -2
  87. package/src/getUserMedia.ts +4 -3
  88. package/src/index.ts +12 -3
  89. package/tsconfig.json +3 -1
  90. package/ios/RCTWebRTC.xcodeproj/xcuserdata/saghul.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  91. package/ios/RCTWebRTC.xcworkspace/xcuserdata/saghul.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
@@ -1,5 +1,6 @@
1
1
  import RTCRtpEncodingParameters, { RTCRtpEncodingParametersInit } from './RTCRtpEncodingParameters';
2
2
  import RTCRtpParameters, { RTCRtpParametersInit } from './RTCRtpParameters';
3
+ import { deepClone } from './RTCUtil';
3
4
 
4
5
  type DegradationPreferenceType = 'maintain-framerate'
5
6
  | 'maintain-resolution'
@@ -31,7 +32,7 @@ export interface RTCRtpSendParametersInit extends RTCRtpParametersInit {
31
32
 
32
33
  export default class RTCRtpSendParameters extends RTCRtpParameters {
33
34
  readonly transactionId: string;
34
- readonly encodings: RTCRtpEncodingParameters[];
35
+ encodings: (RTCRtpEncodingParameters | RTCRtpEncodingParametersInit)[];
35
36
  degradationPreference: DegradationPreferenceType | null;
36
37
 
37
38
  constructor(init: RTCRtpSendParametersInit) {
@@ -47,17 +48,16 @@ export default class RTCRtpSendParameters extends RTCRtpParameters {
47
48
  }
48
49
  }
49
50
 
50
- toJSON(): RTCRtpSendParametersInit {
51
+ toJSON() {
51
52
  const obj = super.toJSON();
52
53
 
53
54
  obj['transactionId'] = this.transactionId;
54
-
55
- obj['encodings'] = this.encodings.map(e => e.toJSON());
55
+ obj['encodings'] = this.encodings.map(e => deepClone(e));
56
56
 
57
57
  if (this.degradationPreference !== null) {
58
58
  obj['degradationPreference'] = DegradationPreference.toNative(this.degradationPreference);
59
59
  }
60
60
 
61
- return obj as RTCRtpSendParametersInit;
61
+ return obj;
62
62
  }
63
63
  }
package/src/RTCView.ts CHANGED
@@ -6,8 +6,7 @@ import { requireNativeComponent, ViewProps } from 'react-native';
6
6
  *
7
7
  * So we list them here for documentation purposes.
8
8
  */
9
-
10
- interface RTCVideoViewProps extends ViewProps {
9
+ export interface RTCVideoViewProps extends ViewProps {
11
10
  /**
12
11
  * Indicates whether the video specified by {@link #streamURL} should be
13
12
  * mirrored during rendering. Commonly, applications choose to mirror the
@@ -24,6 +23,8 @@ interface RTCVideoViewProps extends ViewProps {
24
23
  * resembles the CSS style object-fit.
25
24
  *
26
25
  * objectFit: 'contain' | 'cover'
26
+ *
27
+ * Defaults to 'cover'.
27
28
  */
28
29
  objectFit?: 'contain' | 'cover';
29
30
 
@@ -59,6 +60,53 @@ interface RTCVideoViewProps extends ViewProps {
59
60
  * zOrder: number
60
61
  */
61
62
  zOrder?: number;
63
+
64
+
65
+ /**
66
+ * Picture in picture options for this view. Disabled if not supplied.
67
+ *
68
+ * Note: this should only be generally only used with remote video tracks,
69
+ * as the local camera may stop while in the background.
70
+ *
71
+ * iOS only. Requires iOS 15.0 or above, and the PIP background mode capability.
72
+ */
73
+ iosPIP?: RTCIOSPIPOptions
62
74
  }
63
75
 
76
+ export interface RTCIOSPIPOptions {
77
+
78
+ /**
79
+ * Whether PIP can be launched from this view.
80
+ *
81
+ * Defaults to true.
82
+ */
83
+ enabled?: boolean;
84
+
85
+ /**
86
+ * The preferred size of the PIP window.
87
+ */
88
+ preferredSize?: {
89
+ width: number;
90
+ height: number;
91
+ },
92
+
93
+ /**
94
+ * Indicates whether Picture in Picture starts automatically
95
+ * when the controller embeds its content inline and the app
96
+ * transitions to the background.
97
+ *
98
+ * Defaults to true.
99
+ *
100
+ * See: AVPictureInPictureController.canStartPictureInPictureAutomaticallyFromInline
101
+ */
102
+ startAutomatically?: boolean;
103
+
104
+ /**
105
+ * Indicates whether Picture in Picture should stop automatically
106
+ * when the app returns to the foreground.
107
+ *
108
+ * Defaults to true.
109
+ */
110
+ stopAutomatically?: boolean;
111
+ }
64
112
  export default requireNativeComponent<RTCVideoViewProps>('RTCVideoView');
@@ -2,6 +2,7 @@
2
2
  import { NativeModules } from 'react-native';
3
3
 
4
4
 
5
+ import { MediaTrackConstraints } from './Constraints';
5
6
  import MediaStream from './MediaStream';
6
7
  import MediaStreamError from './MediaStreamError';
7
8
  import permissions from './Permissions';
@@ -9,9 +10,9 @@ import * as RTCUtil from './RTCUtil';
9
10
 
10
11
  const { WebRTCModule } = NativeModules;
11
12
 
12
- interface Constraints {
13
- audio?: boolean | object;
14
- video?: boolean | object;
13
+ export interface Constraints {
14
+ audio?: boolean | MediaTrackConstraints;
15
+ video?: boolean | MediaTrackConstraints;
15
16
  }
16
17
 
17
18
  export default function getUserMedia(constraints: Constraints = {}): Promise<MediaStream> {
package/src/index.ts CHANGED
@@ -12,17 +12,19 @@ import { setupNativeEvents } from './EventEmitter';
12
12
  import Logger from './Logger';
13
13
  import mediaDevices from './MediaDevices';
14
14
  import MediaStream from './MediaStream';
15
- import MediaStreamTrack from './MediaStreamTrack';
15
+ import MediaStreamTrack, { type MediaTrackSettings } from './MediaStreamTrack';
16
16
  import MediaStreamTrackEvent from './MediaStreamTrackEvent';
17
17
  import permissions from './Permissions';
18
+ import RTCAudioSession from './RTCAudioSession';
18
19
  import RTCErrorEvent from './RTCErrorEvent';
19
20
  import RTCIceCandidate from './RTCIceCandidate';
21
+ import RTCPIPView, { startIOSPIP, stopIOSPIP } from './RTCPIPView';
20
22
  import RTCPeerConnection from './RTCPeerConnection';
21
23
  import RTCRtpReceiver from './RTCRtpReceiver';
22
24
  import RTCRtpSender from './RTCRtpSender';
23
25
  import RTCRtpTransceiver from './RTCRtpTransceiver';
24
26
  import RTCSessionDescription from './RTCSessionDescription';
25
- import RTCView from './RTCView';
27
+ import RTCView, { type RTCVideoViewProps, type RTCIOSPIPOptions } from './RTCView';
26
28
  import ScreenCapturePickerView from './ScreenCapturePickerView';
27
29
 
28
30
  Logger.enable(`${Logger.ROOT_PREFIX}:*`);
@@ -35,16 +37,23 @@ export {
35
37
  RTCPeerConnection,
36
38
  RTCSessionDescription,
37
39
  RTCView,
40
+ RTCPIPView,
38
41
  ScreenCapturePickerView,
39
42
  RTCRtpTransceiver,
40
43
  RTCRtpReceiver,
41
44
  RTCRtpSender,
42
45
  RTCErrorEvent,
46
+ RTCAudioSession,
43
47
  MediaStream,
44
48
  MediaStreamTrack,
49
+ type MediaTrackSettings,
50
+ type RTCVideoViewProps,
51
+ type RTCIOSPIPOptions,
45
52
  mediaDevices,
46
53
  permissions,
47
- registerGlobals
54
+ registerGlobals,
55
+ startIOSPIP,
56
+ stopIOSPIP,
48
57
  };
49
58
 
50
59
  declare const global: any;
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "include": ["src/**/*.ts"],
2
+ "include": ["src/**/*.ts", "src/**/*.tsx"],
3
3
  "compilerOptions": {
4
4
  "target": "es6",
5
5
  "module": "commonjs",
@@ -9,6 +9,8 @@
9
9
  "jsx": "react-native",
10
10
  "resolveJsonModule": true,
11
11
  "noImplicitAny": false,
12
+ "allowSyntheticDefaultImports": true,
13
+ "esModuleInterop": true,
12
14
  },
13
15
  "exclude": ["node_modules"]
14
16
  }
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>RCTWebRTC.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>