react-native-webrtc 124.0.5 → 124.0.7

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 (75) hide show
  1. package/.nvmrc +1 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/oney/WebRTCModule/AbstractVideoCaptureController.java +2 -1
  4. package/android/src/main/java/com/oney/WebRTCModule/CameraCaptureController.java +7 -9
  5. package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +39 -19
  6. package/android/src/main/java/com/oney/WebRTCModule/MediaProjectionNotification.java +11 -19
  7. package/android/src/main/java/com/oney/WebRTCModule/MediaProjectionService.java +0 -2
  8. package/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java +4 -2
  9. package/android/src/main/java/com/oney/WebRTCModule/RTCVideoViewManager.java +25 -0
  10. package/android/src/main/java/com/oney/WebRTCModule/ScreenCaptureController.java +1 -4
  11. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +16 -12
  12. package/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java +37 -0
  13. package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoEffectProcessor.java +15 -9
  14. package/android/src/main/java/org/webrtc/Camera1Helper.java +0 -1
  15. package/android/src/main/java/org/webrtc/Camera2Helper.java +4 -3
  16. package/ios/RCTWebRTC/CaptureController.h +1 -1
  17. package/ios/RCTWebRTC/CaptureController.m +6 -7
  18. package/ios/RCTWebRTC/I420Converter.h +3 -2
  19. package/ios/RCTWebRTC/I420Converter.m +55 -47
  20. package/ios/RCTWebRTC/PIPController.h +2 -2
  21. package/ios/RCTWebRTC/PIPController.m +29 -37
  22. package/ios/RCTWebRTC/RTCVideoViewManager.m +38 -17
  23. package/ios/RCTWebRTC/SampleBufferVideoCallView.h +2 -2
  24. package/ios/RCTWebRTC/SampleBufferVideoCallView.m +40 -42
  25. package/ios/RCTWebRTC/ScreenCaptureController.m +1 -5
  26. package/ios/RCTWebRTC/VideoCaptureController.h +1 -0
  27. package/ios/RCTWebRTC/VideoCaptureController.m +6 -7
  28. package/ios/RCTWebRTC/WebRTCModule+Permissions.m +4 -8
  29. package/ios/RCTWebRTC/WebRTCModule+RTCDataChannel.m +31 -40
  30. package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.h +5 -0
  31. package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +68 -22
  32. package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +26 -55
  33. package/ios/RCTWebRTC/WebRTCModule+Transceivers.m +11 -28
  34. package/ios/RCTWebRTC/videoEffects/ProcessorProvider.h +9 -0
  35. package/ios/RCTWebRTC/videoEffects/ProcessorProvider.m +23 -0
  36. package/ios/RCTWebRTC/videoEffects/VideoEffectProcessor.h +13 -0
  37. package/ios/RCTWebRTC/videoEffects/VideoEffectProcessor.m +23 -0
  38. package/ios/RCTWebRTC/videoEffects/VideoFrameProcessor.h +8 -0
  39. package/lib/commonjs/MediaStreamTrack.js +5 -2
  40. package/lib/commonjs/MediaStreamTrack.js.map +1 -1
  41. package/lib/commonjs/Permissions.js +3 -3
  42. package/lib/commonjs/Permissions.js.map +1 -1
  43. package/lib/commonjs/RTCPIPView.js +3 -7
  44. package/lib/commonjs/RTCPIPView.js.map +1 -1
  45. package/lib/commonjs/RTCPeerConnection.js +2 -4
  46. package/lib/commonjs/RTCPeerConnection.js.map +1 -1
  47. package/lib/commonjs/RTCUtil.js +2 -3
  48. package/lib/commonjs/RTCUtil.js.map +1 -1
  49. package/lib/commonjs/RTCView.js.map +1 -1
  50. package/lib/module/MediaStreamTrack.js +5 -2
  51. package/lib/module/MediaStreamTrack.js.map +1 -1
  52. package/lib/module/Permissions.js +3 -3
  53. package/lib/module/Permissions.js.map +1 -1
  54. package/lib/module/RTCPIPView.js +3 -7
  55. package/lib/module/RTCPIPView.js.map +1 -1
  56. package/lib/module/RTCPeerConnection.js +2 -4
  57. package/lib/module/RTCPeerConnection.js.map +1 -1
  58. package/lib/module/RTCUtil.js +2 -3
  59. package/lib/module/RTCUtil.js.map +1 -1
  60. package/lib/module/RTCView.js.map +1 -1
  61. package/lib/typescript/MediaStreamTrack.d.ts +1 -0
  62. package/lib/typescript/Permissions.d.ts +1 -1
  63. package/lib/typescript/RTCPIPView.d.ts +2 -1
  64. package/lib/typescript/RTCPeerConnection.d.ts +2 -1
  65. package/lib/typescript/RTCUtil.d.ts +7 -1
  66. package/lib/typescript/RTCView.d.ts +14 -0
  67. package/package.json +1 -1
  68. package/src/MediaStreamTrack.ts +6 -2
  69. package/src/Permissions.ts +3 -3
  70. package/src/RTCPIPView.tsx +3 -2
  71. package/src/RTCPeerConnection.ts +4 -5
  72. package/src/RTCUtil.ts +10 -3
  73. package/src/RTCView.ts +11 -1
  74. package/tools/release.sh +1 -1
  75. package/tools/build-webrtc.py +0 -344
package/src/RTCView.ts CHANGED
@@ -70,7 +70,17 @@ export interface RTCVideoViewProps extends ViewProps {
70
70
  *
71
71
  * iOS only. Requires iOS 15.0 or above, and the PIP background mode capability.
72
72
  */
73
- iosPIP?: RTCIOSPIPOptions
73
+ iosPIP?: RTCIOSPIPOptions;
74
+
75
+ /**
76
+ * Callback function that is called when the dimensions of the video change.
77
+ *
78
+ * @param {Object} event - The event object containing the new dimensions.
79
+ * @param {Object} event.nativeEvent - The native event data.
80
+ * @param {number} event.nativeEvent.width - The width of the video.
81
+ * @param {number} event.nativeEvent.height - The height of the video.
82
+ */
83
+ onDimensionsChange?: (event: { nativeEvent: { width: number; height: number } }) => void;
74
84
  }
75
85
 
76
86
  export interface RTCIOSPIPOptions {
package/tools/release.sh CHANGED
@@ -33,7 +33,7 @@ git_log_cmd='git log '$last_version'..HEAD --no-merges --pretty=format:%h%x20%s%
33
33
 
34
34
  # --- commit with change logs
35
35
  git add package.json package-lock.json
36
- git commit -m "release ${version}" -m "$($git_log_cmd)"
36
+ git commit -m "release: ${version}" -m "$($git_log_cmd)"
37
37
  git tag -a "$version" -m "$($git_log_cmd)"
38
38
 
39
39
  # --- success messages
@@ -1,344 +0,0 @@
1
- from __future__ import print_function
2
-
3
- import argparse
4
- import errno
5
- import os
6
- import shutil
7
- import subprocess
8
- import sys
9
-
10
-
11
- # Constants
12
-
13
- APPLE_FRAMEWORK_NAME = 'WebRTC.framework'
14
- APPLE_DSYM_NAME = 'WebRTC.dSYM'
15
-
16
- ANDROID_CPU_ABI_MAP = {
17
- 'arm' : 'armeabi-v7a',
18
- 'arm64' : 'arm64-v8a',
19
- 'x86' : 'x86',
20
- 'x64' : 'x86_64'
21
- }
22
- ANDROID_BUILD_CPUS = [
23
- 'arm',
24
- 'arm64',
25
- 'x86',
26
- 'x64'
27
- ]
28
- IOS_BUILD_ARCHS = [
29
- 'device:arm64',
30
- 'simulator:arm64',
31
- 'simulator:x64'
32
- ]
33
- MACOS_BUILD_ARCHS = [
34
- 'x64'
35
- ]
36
-
37
- def build_gn_args(platform_args):
38
- return "--args='" + ' '.join(GN_COMMON_ARGS + platform_args) + "'"
39
-
40
- GN_COMMON_ARGS = [
41
- 'rtc_libvpx_build_vp9=true',
42
- 'rtc_enable_protobuf=false',
43
- 'rtc_include_tests=false',
44
- 'is_debug=%s',
45
- 'target_cpu="%s"'
46
- ]
47
-
48
- _GN_APPLE_COMMON = [
49
- 'enable_dsyms=true',
50
- 'enable_stripping=true',
51
- 'rtc_enable_symbol_export=false',
52
- 'rtc_enable_objc_symbol_export=true'
53
- ]
54
-
55
- _GN_IOS_ARGS = [
56
- 'ios_deployment_target="12.0"',
57
- 'ios_enable_code_signing=false',
58
- 'target_os="ios"',
59
- 'target_environment="%s"'
60
- ]
61
- GN_IOS_ARGS = build_gn_args(_GN_APPLE_COMMON + _GN_IOS_ARGS)
62
-
63
- _GN_MACOS_ARGS = [
64
- 'target_os="mac"'
65
- ]
66
- GN_MACOS_ARGS = build_gn_args(_GN_APPLE_COMMON + _GN_MACOS_ARGS)
67
-
68
- _GN_ANDROID_ARGS = [
69
- 'target_os="android"'
70
- ]
71
- GN_ANDROID_ARGS = build_gn_args(_GN_ANDROID_ARGS)
72
-
73
-
74
- # Utilities
75
-
76
- def sh(cmd, env=None, cwd=None):
77
- print('Running cmd: %s' % cmd)
78
- try:
79
- subprocess.check_call(cmd, env=env, cwd=cwd, shell=True, stdin=sys.stdin, stdout=sys.stdout, stderr=subprocess.STDOUT)
80
- except subprocess.CalledProcessError as e:
81
- sys.exit(e.returncode)
82
- except KeyboardInterrupt:
83
- pass
84
-
85
- def mkdirp(path):
86
- try:
87
- os.makedirs(path)
88
- except OSError as e:
89
- if e.errno != errno.EEXIST:
90
- raise
91
-
92
- def rmr(path):
93
- try:
94
- shutil.rmtree(path)
95
- except OSError as e:
96
- if e.errno != errno.ENOENT:
97
- raise
98
-
99
-
100
- # The Real Deal
101
-
102
- def setup(target_dir, platform):
103
- mkdirp(target_dir)
104
- os.chdir(target_dir)
105
-
106
- # Maybe fetch depot_tools
107
- depot_tools_dir = os.path.join(target_dir, 'depot_tools')
108
- if not os.path.isdir(depot_tools_dir):
109
- print('Fetching Chromium depot_tools...')
110
- sh('git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git')
111
-
112
- # Prepare environment
113
- env = os.environ.copy()
114
- env['PATH'] = '%s:%s' % (env['PATH'], depot_tools_dir)
115
-
116
- # Maybe fetch WebRTC
117
- webrtc_dir = os.path.join(target_dir, 'webrtc', platform)
118
- if not os.path.isdir(webrtc_dir):
119
- mkdirp(webrtc_dir)
120
- os.chdir(webrtc_dir)
121
- print('Fetching WebRTC for %s...' % platform)
122
- sh('fetch --nohooks webrtc_%s' % platform, env)
123
-
124
- # Run gclient
125
- sh('gclient sync', env)
126
-
127
- # Install dependencies
128
- if platform == 'android':
129
- webrtc_dir = os.path.join(target_dir, 'webrtc', platform, 'src')
130
- os.chdir(webrtc_dir)
131
- sh('./build/install-build-deps.sh')
132
-
133
-
134
- def sync(target_dir, platform):
135
- build_dir = os.path.join(target_dir, 'build', platform)
136
- depot_tools_dir = os.path.join(target_dir, 'depot_tools')
137
- webrtc_dir = os.path.join(target_dir, 'webrtc', platform, 'src')
138
-
139
- if not os.path.isdir(webrtc_dir):
140
- print('WebRTC source not found, did you forget to run --setup?')
141
- sys.exit(1)
142
-
143
- # Prepare environment
144
- env = os.environ.copy()
145
- path_parts = [env['PATH'], depot_tools_dir]
146
- if platform == 'android':
147
- # Same as . build/android/envsetup.sh
148
- android_sdk_root = os.path.join(webrtc_dir, 'third_party/android_sdk/public')
149
- path_parts.append(os.path.join(android_sdk_root, 'platform-tools'))
150
- path_parts.append(os.path.join(android_sdk_root, 'tools'))
151
- path_parts.append(os.path.join(webrtc_dir, 'build/android'))
152
- env['PATH'] = ':'.join(path_parts)
153
-
154
- os.chdir(webrtc_dir)
155
-
156
- sh('gclient sync -D', env)
157
-
158
-
159
- def build(target_dir, platform, debug):
160
- build_dir = os.path.join(target_dir, 'build', platform)
161
- build_type = 'Debug' if debug else 'Release'
162
- depot_tools_dir = os.path.join(target_dir, 'depot_tools')
163
- webrtc_dir = os.path.join(target_dir, 'webrtc', platform, 'src')
164
-
165
- if not os.path.isdir(webrtc_dir):
166
- print('WebRTC source not found, did you forget to run --setup?')
167
- sys.exit(1)
168
-
169
- # Prepare environment
170
- env = os.environ.copy()
171
- path_parts = [env['PATH'], depot_tools_dir]
172
- if platform == 'android':
173
- # Same as . build/android/envsetup.sh
174
- android_sdk_root = os.path.join(webrtc_dir, 'third_party/android_sdk/public')
175
- path_parts.append(os.path.join(android_sdk_root, 'platform-tools'))
176
- path_parts.append(os.path.join(android_sdk_root, 'tools'))
177
- path_parts.append(os.path.join(webrtc_dir, 'build/android'))
178
- env['PATH'] = ':'.join(path_parts)
179
-
180
- os.chdir(webrtc_dir)
181
-
182
- # Cleanup old build
183
- rmr('out')
184
-
185
- # Run GN
186
- if platform == 'ios':
187
- for item in IOS_BUILD_ARCHS:
188
- tenv, arch = item.split(':')
189
- gn_out_dir = 'out/%s-ios-%s-%s' % (build_type, tenv, arch)
190
- gn_args = GN_IOS_ARGS % (str(debug).lower(), arch, tenv)
191
- gn_cmd = 'gn gen %s %s' % (gn_out_dir, gn_args)
192
- sh(gn_cmd, env)
193
- #for arch in MACOS_BUILD_ARCHS:
194
- # gn_out_dir = 'out/%s-macos-%s' % (build_type, arch)
195
- # gn_args = GN_MACOS_ARGS % (str(debug).lower(), arch)
196
- # gn_cmd = 'gn gen %s %s' % (gn_out_dir, gn_args)
197
- # sh(gn_cmd, env)
198
- else:
199
- for cpu in ANDROID_BUILD_CPUS:
200
- gn_out_dir = 'out/%s-%s' % (build_type, cpu)
201
- gn_args = GN_ANDROID_ARGS % (str(debug).lower(), cpu)
202
- gn_cmd = 'gn gen %s %s' % (gn_out_dir, gn_args)
203
- sh(gn_cmd, env)
204
-
205
- # Build with Ninja
206
- if platform == 'ios':
207
- for item in IOS_BUILD_ARCHS:
208
- tenv, arch = item.split(':')
209
- gn_out_dir = 'out/%s-ios-%s-%s' % (build_type, tenv, arch)
210
- ninja_cmd = 'ninja -C %s framework_objc' % gn_out_dir
211
- sh(ninja_cmd, env)
212
- #for arch in MACOS_BUILD_ARCHS:
213
- # gn_out_dir = 'out/%s-macos-%s' % (build_type, arch)
214
- # ninja_cmd = 'ninja -C %s mac_framework_objc' % gn_out_dir
215
- # sh(ninja_cmd, env)
216
- else:
217
- for cpu in ANDROID_BUILD_CPUS:
218
- gn_out_dir = 'out/%s-%s' % (build_type, cpu)
219
- ninja_cmd = 'ninja -C %s libwebrtc libjingle_peerconnection_so' % gn_out_dir
220
- sh(ninja_cmd, env)
221
-
222
- # Cleanup build dir
223
- rmr(build_dir)
224
- mkdirp(build_dir)
225
-
226
- # Copy build artifacts to build directory
227
- if platform == 'ios':
228
- # Fat simulators (we need a single slice for both simulators)
229
- simulators = [item for item in IOS_BUILD_ARCHS if item.startswith('simulator')]
230
- tenv, arch = simulators[0].split(':')
231
- gn_out_dir = 'out/%s-ios-%s-%s' % (build_type, tenv, arch)
232
-
233
- shutil.copytree(os.path.join(gn_out_dir, APPLE_FRAMEWORK_NAME), os.path.join(gn_out_dir, 'fat-' + APPLE_FRAMEWORK_NAME))
234
- out_lib_path = os.path.join(gn_out_dir, 'fat-' + APPLE_FRAMEWORK_NAME, 'WebRTC')
235
- slice_paths = []
236
- for item in simulators:
237
- tenv, arch = item.split(':')
238
- lib_path = os.path.join('out/%s-ios-%s-%s' % (build_type, tenv, arch), APPLE_FRAMEWORK_NAME, 'WebRTC')
239
- slice_paths.append(lib_path)
240
- sh('lipo %s -create -output %s' % (' '.join(slice_paths), out_lib_path))
241
-
242
- orig_framework_path = os.path.join(gn_out_dir, APPLE_FRAMEWORK_NAME)
243
- bak_framework_path = os.path.join(gn_out_dir, 'bak-' + APPLE_FRAMEWORK_NAME)
244
- fat_framework_path = os.path.join(gn_out_dir, 'fat-' + APPLE_FRAMEWORK_NAME)
245
- shutil.move(orig_framework_path, bak_framework_path)
246
- shutil.move(fat_framework_path, orig_framework_path)
247
-
248
- # dSYMs
249
- shutil.copytree(os.path.join(gn_out_dir, APPLE_DSYM_NAME), os.path.join(gn_out_dir, 'fat-' + APPLE_DSYM_NAME))
250
- out_dsym_path = os.path.join(gn_out_dir, 'fat-' + APPLE_DSYM_NAME, 'Contents', 'Resources', 'DWARF', 'WebRTC')
251
- slice_paths = []
252
- for item in simulators:
253
- tenv, arch = item.split(':')
254
- dsym_path = os.path.join('out/%s-ios-%s-%s' % (build_type, tenv, arch), APPLE_DSYM_NAME, 'Contents', 'Resources', 'DWARF', 'WebRTC')
255
- slice_paths.append(dsym_path)
256
- sh('lipo %s -create -output %s' % (' '.join(slice_paths), out_dsym_path))
257
-
258
- orig_dsym_path = os.path.join(gn_out_dir, APPLE_DSYM_NAME)
259
- bak_dsym_path = os.path.join(gn_out_dir, 'bak-' + APPLE_DSYM_NAME)
260
- fat_dsym_path = os.path.join(gn_out_dir, 'fat-' + APPLE_DSYM_NAME)
261
- shutil.move(orig_dsym_path, bak_dsym_path)
262
- shutil.move(fat_dsym_path, orig_dsym_path)
263
-
264
- _IOS_BUILD_ARCHS = [item for item in IOS_BUILD_ARCHS if not item.startswith('simulator')]
265
- _IOS_BUILD_ARCHS.append(simulators[0])
266
-
267
- # XCFramework
268
- xcframework_path = os.path.join(build_dir, 'WebRTC.xcframework')
269
- xcodebuild_cmd = 'xcodebuild -create-xcframework -output %s' % xcframework_path
270
- for item in _IOS_BUILD_ARCHS:
271
- tenv, arch = item.split(':')
272
- gn_out_dir = 'out/%s-ios-%s-%s' % (build_type, tenv, arch)
273
- xcodebuild_cmd += ' -framework %s' % os.path.abspath(os.path.join(gn_out_dir, APPLE_FRAMEWORK_NAME))
274
- xcodebuild_cmd += ' -debug-symbols %s' % os.path.abspath(os.path.join(gn_out_dir, APPLE_DSYM_NAME))
275
- #for arch in MACOS_BUILD_ARCHS:
276
- # gn_out_dir = 'out/%s-macos-%s' % (build_type, arch)
277
- # xcodebuild_cmd += ' -framework %s' % os.path.join(gn_out_dir, APPLE_FRAMEWORK_NAME)
278
- sh(xcodebuild_cmd)
279
- sh('zip -r WebRTC.xcframework.zip WebRTC.xcframework', cwd=build_dir)
280
- rmr(xcframework_path)
281
- else:
282
- gn_out_dir = 'out/%s-%s' % (build_type, ANDROID_BUILD_CPUS[0])
283
- shutil.copy(os.path.join(gn_out_dir, 'lib.java/sdk/android/libwebrtc.jar'), build_dir)
284
-
285
- for cpu in ANDROID_BUILD_CPUS:
286
- lib_dir = os.path.join(build_dir, 'lib', ANDROID_CPU_ABI_MAP[cpu])
287
- mkdirp(lib_dir)
288
- gn_out_dir = 'out/%s-%s' % (build_type, cpu)
289
- shutil.copy(os.path.join(gn_out_dir, 'libjingle_peerconnection_so.so'), lib_dir)
290
-
291
- sh('jar cvfM libjingle_peerconnection.so.jar lib', cwd=build_dir)
292
- rmr(os.path.join(build_dir, 'lib'))
293
- sh('zip -r android-webrtc.zip *.jar', cwd=build_dir)
294
-
295
-
296
- if __name__ == "__main__":
297
- parser = argparse.ArgumentParser()
298
- parser.add_argument('dir', help='Target directory')
299
- parser.add_argument('--setup', help='Prepare the target directory for building', action='store_true')
300
- parser.add_argument('--build', help='Build WebRTC in the target directory', action='store_true')
301
- parser.add_argument('--sync', help='Runs gclient sync on the WebRTC directory', action='store_true')
302
- parser.add_argument('--ios', help='Use iOS as the target platform', action='store_true')
303
- parser.add_argument('--android', help='Use Android as the target platform', action='store_true')
304
- parser.add_argument('--debug', help='Make a Debug build (defaults to false)', action='store_true')
305
-
306
- args = parser.parse_args()
307
-
308
- if not (args.setup or args.build or args.sync):
309
- print('--setup or --build must be specified!')
310
- sys.exit(1)
311
-
312
- if args.setup and args.build:
313
- print('--setup and --build cannot be specified at the same time!')
314
- sys.exit(1)
315
-
316
- if not (args.ios or args.android):
317
- print('--ios or --android must be specified!')
318
- sys.exit(1)
319
-
320
- if args.ios and args.android:
321
- print('--ios and --android cannot be specified at the same time!')
322
- sys.exit(1)
323
-
324
- if not os.path.isdir(args.dir):
325
- print('The specified directory does not exist!')
326
- sys.exit(1)
327
-
328
- target_dir = os.path.abspath(os.path.join(args.dir, 'build_webrtc'))
329
- platform = 'ios' if args.ios else 'android'
330
-
331
- if args.setup:
332
- setup(target_dir, platform)
333
- print('WebRTC setup for %s completed in %s' % (platform, target_dir))
334
- sys.exit(0)
335
-
336
- if args.sync:
337
- sync(target_dir, platform)
338
- print('WebRTC sync for %s completed in %s' % (platform, target_dir))
339
- sys.exit(0)
340
-
341
- if args.build:
342
- build(target_dir, platform, args.debug)
343
- print('WebRTC build for %s completed in %s' % (platform, target_dir))
344
- sys.exit(0)