react-native-webrtc 1.100.0 → 1.106.0

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 (56) hide show
  1. package/ISSUE_TEMPLATE.md +17 -13
  2. package/README.md +46 -128
  3. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +4 -8
  4. package/ios/RCTWebRTC/RCTConvert+WebRTC.m +1 -4
  5. package/ios/RCTWebRTC/ScreenCaptureController.m +4 -0
  6. package/ios/RCTWebRTC/ScreenCapturer.m +7 -1
  7. package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +2 -0
  8. package/lib/commonjs/MediaStream.js +1 -1
  9. package/lib/commonjs/MediaStream.js.map +1 -1
  10. package/lib/commonjs/MediaStreamTrack.js.map +1 -1
  11. package/lib/commonjs/Permissions.js +1 -1
  12. package/lib/commonjs/Permissions.js.map +1 -1
  13. package/lib/commonjs/RTCDataChannel.js.map +1 -1
  14. package/lib/commonjs/RTCPeerConnection.js.map +1 -1
  15. package/lib/commonjs/RTCSessionDescription.js.map +1 -1
  16. package/lib/commonjs/RTCUtil.js +15 -32
  17. package/lib/commonjs/RTCUtil.js.map +1 -1
  18. package/lib/commonjs/getDisplayMedia.js.map +1 -1
  19. package/lib/commonjs/getUserMedia.js.map +1 -1
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/module/MediaStream.js +1 -1
  22. package/lib/module/MediaStream.js.map +1 -1
  23. package/lib/module/MediaStreamTrack.js.map +1 -1
  24. package/lib/module/Permissions.js +1 -1
  25. package/lib/module/Permissions.js.map +1 -1
  26. package/lib/module/RTCDataChannel.js.map +1 -1
  27. package/lib/module/RTCPeerConnection.js.map +1 -1
  28. package/lib/module/RTCSessionDescription.js.map +1 -1
  29. package/lib/module/RTCUtil.js +14 -32
  30. package/lib/module/RTCUtil.js.map +1 -1
  31. package/lib/module/getDisplayMedia.js.map +1 -1
  32. package/lib/module/getUserMedia.js.map +1 -1
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/typescript/MediaDevices.d.ts +2 -2
  35. package/lib/typescript/MediaStream.d.ts +6 -6
  36. package/lib/typescript/MediaStreamTrack.d.ts +5 -5
  37. package/lib/typescript/RTCDataChannel.d.ts +4 -2
  38. package/lib/typescript/RTCPeerConnection.d.ts +3 -3
  39. package/lib/typescript/RTCUtil.d.ts +4 -8
  40. package/lib/typescript/getDisplayMedia.d.ts +2 -1
  41. package/lib/typescript/getUserMedia.d.ts +2 -1
  42. package/package.json +3 -4
  43. package/react-native-webrtc.podspec +2 -3
  44. package/src/MediaStream.ts +11 -11
  45. package/src/MediaStreamTrack.ts +6 -6
  46. package/src/Permissions.ts +1 -1
  47. package/src/RTCDataChannel.ts +11 -8
  48. package/src/RTCPeerConnection.ts +11 -11
  49. package/src/RTCSessionDescription.ts +3 -3
  50. package/src/RTCUtil.ts +17 -37
  51. package/src/getDisplayMedia.ts +1 -1
  52. package/src/getUserMedia.ts +2 -2
  53. package/src/index.ts +1 -1
  54. package/tools/build-webrtc.py +32 -33
  55. package/tools/downloadBitcode.sh +3 -12
  56. package/tools/downloadWebRTC.js +26 -15
@@ -55,7 +55,7 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
55
55
  return this._muted;
56
56
  }
57
57
 
58
- stop() {
58
+ stop(): void {
59
59
  WebRTCModule.mediaStreamTrackSetEnabled(this.id, false);
60
60
  this.readyState = 'ended';
61
61
  // TODO: save some stopped flag?
@@ -68,7 +68,7 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
68
68
  * This is how the reference application (AppRTCMobile) implements camera
69
69
  * switching.
70
70
  */
71
- _switchCamera() {
71
+ _switchCamera(): void {
72
72
  if (this.remote) {
73
73
  throw new Error('Not implemented for remote tracks');
74
74
  }
@@ -78,15 +78,15 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
78
78
  WebRTCModule.mediaStreamTrackSwitchCamera(this.id);
79
79
  }
80
80
 
81
- applyConstraints() {
81
+ applyConstraints(): never {
82
82
  throw new Error('Not implemented.');
83
83
  }
84
84
 
85
- clone() {
85
+ clone(): never {
86
86
  throw new Error('Not implemented.');
87
87
  }
88
88
 
89
- getCapabilities() {
89
+ getCapabilities(): never {
90
90
  throw new Error('Not implemented.');
91
91
  }
92
92
 
@@ -98,7 +98,7 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
98
98
  return deepClone(this._settings);
99
99
  }
100
100
 
101
- release() {
101
+ release(): void {
102
102
  WebRTCModule.mediaStreamTrackRelease(this.id);
103
103
  }
104
104
  }
@@ -84,7 +84,7 @@ class Permissions {
84
84
  permissionDesc.name === 'camera'
85
85
  ? PermissionsAndroid.PERMISSIONS.CAMERA
86
86
  : PermissionsAndroid.PERMISSIONS.RECORD_AUDIO;
87
- return new Promise((resolve, reject) => {
87
+ return new Promise(resolve => {
88
88
  PermissionsAndroid.check(perm).then(
89
89
  granted => resolve(granted ? this.RESULT.GRANTED : this.RESULT.PROMPT),
90
90
  () => resolve(this.RESULT.PROMPT)
@@ -23,11 +23,11 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
23
23
  _ordered: boolean;
24
24
  _protocol: string;
25
25
  _readyState: RTCDataChannelState;
26
- _subscriptions: Array<any> = [];
26
+ _subscriptions: any[] = [];
27
27
 
28
- binaryType: string = 'arraybuffer'; // we only support 'arraybuffer'
29
- bufferedAmount: number = 0;
30
- bufferedAmountLowThreshold: number = 0;
28
+ binaryType = 'arraybuffer'; // we only support 'arraybuffer'
29
+ bufferedAmount = 0;
30
+ bufferedAmountLowThreshold = 0;
31
31
 
32
32
  constructor(info) {
33
33
  super();
@@ -79,7 +79,10 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
79
79
  return this._readyState;
80
80
  }
81
81
 
82
- send(data: string | ArrayBuffer | ArrayBufferView) {
82
+ send(data: string): void;
83
+ send(data: ArrayBuffer): void;
84
+ send(data: ArrayBufferView): void;
85
+ send(data: string | ArrayBuffer | ArrayBufferView): void {
83
86
  if (typeof data === 'string') {
84
87
  WebRTCModule.dataChannelSend(this._peerConnectionId, this._reactTag, data, 'text');
85
88
  return;
@@ -96,19 +99,19 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
96
99
  WebRTCModule.dataChannelSend(this._peerConnectionId, this._reactTag, base64.fromByteArray(data as Uint8Array), 'binary');
97
100
  }
98
101
 
99
- close() {
102
+ close(): void {
100
103
  if (this._readyState === 'closing' || this._readyState === 'closed') {
101
104
  return;
102
105
  }
103
106
  WebRTCModule.dataChannelClose(this._peerConnectionId, this._reactTag);
104
107
  }
105
108
 
106
- _unregisterEvents() {
109
+ _unregisterEvents(): void {
107
110
  this._subscriptions.forEach(e => e.remove());
108
111
  this._subscriptions = [];
109
112
  }
110
113
 
111
- _registerEvents() {
114
+ _registerEvents(): void {
112
115
  this._subscriptions = [
113
116
  EventEmitter.addListener('dataChannelStateChanged', ev => {
114
117
  if (ev.reactTag !== this._reactTag) {
@@ -64,9 +64,9 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
64
64
  iceConnectionState: RTCIceConnectionState = 'new';
65
65
 
66
66
  _peerConnectionId: number;
67
- _localStreams: Array<MediaStream> = [];
68
- _remoteStreams: Array<MediaStream> = [];
69
- _subscriptions: Array<any> = [];
67
+ _localStreams: MediaStream[] = [];
68
+ _remoteStreams: MediaStream[] = [];
69
+ _subscriptions: any[] = [];
70
70
 
71
71
  constructor(configuration) {
72
72
  super();
@@ -75,7 +75,7 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
75
75
  this._registerEvents();
76
76
  }
77
77
 
78
- addStream(stream: MediaStream) {
78
+ addStream(stream: MediaStream): void {
79
79
  const index = this._localStreams.indexOf(stream);
80
80
  if (index !== -1) {
81
81
  return;
@@ -84,7 +84,7 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
84
84
  this._localStreams.push(stream);
85
85
  }
86
86
 
87
- removeStream(stream: MediaStream) {
87
+ removeStream(stream: MediaStream): void {
88
88
  const index = this._localStreams.indexOf(stream);
89
89
  if (index === -1) {
90
90
  return;
@@ -125,7 +125,7 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
125
125
  });
126
126
  }
127
127
 
128
- setConfiguration(configuration) {
128
+ setConfiguration(configuration): void {
129
129
  WebRTCModule.peerConnectionSetConfiguration(configuration, this._peerConnectionId);
130
130
  }
131
131
 
@@ -188,19 +188,19 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
188
188
  });
189
189
  }
190
190
 
191
- getLocalStreams() {
191
+ getLocalStreams(): MediaStream[] {
192
192
  return this._localStreams.slice();
193
193
  }
194
194
 
195
- getRemoteStreams() {
195
+ getRemoteStreams(): MediaStream[] {
196
196
  return this._remoteStreams.slice();
197
197
  }
198
198
 
199
- close() {
199
+ close(): void {
200
200
  WebRTCModule.peerConnectionClose(this._peerConnectionId);
201
201
  }
202
202
 
203
- restartIce() {
203
+ restartIce(): void {
204
204
  WebRTCModule.peerConnectionRestartIce(this._peerConnectionId);
205
205
  }
206
206
 
@@ -339,7 +339,7 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
339
339
  * values with which to initialize corresponding attributes of the new
340
340
  * instance such as id
341
341
  */
342
- createDataChannel(label: string, dataChannelDict?: RTCDataChannelInit) {
342
+ createDataChannel(label: string, dataChannelDict?: RTCDataChannelInit): RTCDataChannel {
343
343
  if (dataChannelDict && 'id' in dataChannelDict) {
344
344
  const id = dataChannelDict.id;
345
345
  if (typeof id !== 'number') {
@@ -8,15 +8,15 @@ export default class RTCSessionDescription {
8
8
  this._type = info.type;
9
9
  }
10
10
 
11
- get sdp() {
11
+ get sdp(): string {
12
12
  return this._sdp;
13
13
  }
14
14
 
15
- get type() {
15
+ get type(): string | null {
16
16
  return this._type;
17
17
  }
18
18
 
19
- toJSON() {
19
+ toJSON(): { sdp: string, type: string | null } {
20
20
  return {
21
21
  sdp: this._sdp,
22
22
  type: this._type
package/src/RTCUtil.ts CHANGED
@@ -8,6 +8,8 @@ const DEFAULT_VIDEO_CONSTRAINTS = {
8
8
  width: 1280
9
9
  };
10
10
 
11
+ const FACING_MODES = [ 'user', 'environment' ];
12
+
11
13
  const ASPECT_RATIO = 16 / 9;
12
14
 
13
15
  const STANDARD_OA_OPTIONS = {
@@ -63,32 +65,19 @@ function normalizeMediaConstraints(constraints, mediaType) {
63
65
  case 'audio':
64
66
  return constraints;
65
67
  case 'video': {
66
- let c;
67
- if (constraints.mandatory) {
68
- // Old style.
69
- c = {
70
- deviceId: extractString(constraints.optional || {}, 'sourceId'),
71
- facingMode: extractString(constraints, 'facingMode'),
72
- frameRate: extractNumber(constraints.mandatory, 'minFrameRate'),
73
- height: extractNumber(constraints.mandatory, 'minHeight'),
74
- width: extractNumber(constraints.mandatory, 'minWidth')
75
- };
76
- } else {
77
- // New style.
78
- c = {
79
- deviceId: extractString(constraints, 'deviceId'),
80
- facingMode: extractString(constraints, 'facingMode'),
81
- frameRate: extractNumber(constraints, 'frameRate'),
82
- height: extractNumber(constraints, 'height'),
83
- width: extractNumber(constraints, 'width')
84
- };
85
- }
68
+ const c = {
69
+ deviceId: extractString(constraints, 'deviceId'),
70
+ facingMode: extractString(constraints, 'facingMode'),
71
+ frameRate: extractNumber(constraints, 'frameRate'),
72
+ height: extractNumber(constraints, 'height'),
73
+ width: extractNumber(constraints, 'width')
74
+ };
86
75
 
87
76
  if (!c.deviceId) {
88
77
  delete c.deviceId;
89
78
  }
90
79
 
91
- if (!c.facingMode || (c.facingMode !== 'user' && c.facingMode !== 'environment')) {
80
+ if (!FACING_MODES.includes(c.facingMode)) {
92
81
  c.facingMode = DEFAULT_VIDEO_CONSTRAINTS.facingMode;
93
82
  }
94
83
 
@@ -99,9 +88,9 @@ function normalizeMediaConstraints(constraints, mediaType) {
99
88
  if (!c.height && !c.width) {
100
89
  c.height = DEFAULT_VIDEO_CONSTRAINTS.height;
101
90
  c.width = DEFAULT_VIDEO_CONSTRAINTS.width;
102
- } else if (!c.height) {
91
+ } else if (!c.height && c.width) {
103
92
  c.height = Math.round(c.width / ASPECT_RATIO);
104
- } else if (!c.width) {
93
+ } else if (!c.width && c.height) {
105
94
  c.width = Math.round(c.height * ASPECT_RATIO);
106
95
  }
107
96
 
@@ -129,7 +118,7 @@ function chr4() {
129
118
  *
130
119
  * @return {String} uuidv4
131
120
  */
132
- export function uniqueID() {
121
+ export function uniqueID(): string {
133
122
  return `${chr4()}${chr4()}-${chr4()}-${chr4()}-${chr4()}-${chr4()}${chr4()}${chr4()}`;
134
123
  }
135
124
 
@@ -139,32 +128,23 @@ export function uniqueID() {
139
128
  * @param {Object} obj - object to be cloned
140
129
  * @return {Object} cloned obj
141
130
  */
142
- export function deepClone(obj) {
131
+ export function deepClone<T>(obj: T): T {
143
132
  return JSON.parse(JSON.stringify(obj));
144
133
  }
145
134
 
146
- interface Constraints {
147
- mandatory?: object;
148
- }
149
-
150
135
  /**
151
136
  * Normalize options passed to createOffer() / createAnswer().
152
137
  *
153
- * @param {Object} options - user supplied options
154
- * @return {Object} newOptions - normalized options
138
+ * @param options - user supplied options
139
+ * @return Normalized options
155
140
  */
156
- export function normalizeOfferAnswerOptions(options: Constraints = {}) {
141
+ export function normalizeOfferAnswerOptions(options: object = {}): object {
157
142
  const newOptions = {};
158
143
 
159
144
  if (!options) {
160
145
  return newOptions;
161
146
  }
162
147
 
163
- // Support legacy constraints.
164
- if (options.mandatory) {
165
- options = options.mandatory;
166
- }
167
-
168
148
  // Convert standard options into WebRTC internal constant names.
169
149
  // See: https://github.com/jitsi/webrtc/blob/0cd6ce4de669bed94ba47b88cb71b9be0341bb81/sdk/media_constraints.cc#L113
170
150
  for (const [key, value] of Object.entries(options)) {
@@ -6,7 +6,7 @@ import MediaStreamError from './MediaStreamError';
6
6
 
7
7
  const { WebRTCModule } = NativeModules;
8
8
 
9
- export default function getDisplayMedia() {
9
+ export default function getDisplayMedia(): Promise<MediaStream> {
10
10
  return new Promise((resolve, reject) => {
11
11
  WebRTCModule.getDisplayMedia().then(
12
12
  data => {
@@ -13,7 +13,7 @@ interface Constraints {
13
13
  video?: boolean | object;
14
14
  }
15
15
 
16
- export default function getUserMedia(constraints: Constraints = {}) {
16
+ export default function getUserMedia(constraints: Constraints = {}): Promise<MediaStream> {
17
17
  // According to
18
18
  // https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia,
19
19
  // the constraints argument is a dictionary of type MediaStreamConstraints.
@@ -32,7 +32,7 @@ export default function getUserMedia(constraints: Constraints = {}) {
32
32
  constraints = RTCUtil.normalizeConstraints(constraints);
33
33
 
34
34
  // Request required permissions
35
- const reqPermissions: Array<Promise<boolean>> = [];
35
+ const reqPermissions: Promise<boolean>[] = [];
36
36
  if (constraints.audio) {
37
37
  reqPermissions.push(permissions.request({ name: 'microphone' }));
38
38
  } else {
package/src/index.ts CHANGED
@@ -21,7 +21,7 @@ export {
21
21
  registerGlobals
22
22
  };
23
23
 
24
- function registerGlobals() {
24
+ function registerGlobals(): void {
25
25
  // Should not happen. React Native has a global navigator object.
26
26
  if (typeof global.navigator !== 'object') {
27
27
  throw new Error('navigator is not an object');
@@ -10,6 +10,9 @@ import sys
10
10
 
11
11
  # Constants
12
12
 
13
+ APPLE_FRAMEWORK_NAME = 'WebRTC.framework'
14
+ APPLE_DSYM_NAME = 'WebRTC.dSYM'
15
+
13
16
  ANDROID_CPU_ABI_MAP = {
14
17
  'arm' : 'armeabi-v7a',
15
18
  'arm64' : 'arm64-v8a',
@@ -35,10 +38,7 @@ def build_gn_args(platform_args):
35
38
  return "--args='" + ' '.join(GN_COMMON_ARGS + platform_args) + "'"
36
39
 
37
40
  GN_COMMON_ARGS = [
38
- 'is_component_build=false',
39
41
  'rtc_libvpx_build_vp9=true',
40
- 'rtc_build_dcsctp=true',
41
- 'rtc_build_usrsctp=false',
42
42
  'rtc_enable_protobuf=false',
43
43
  'rtc_include_tests=false',
44
44
  'is_debug=%s',
@@ -46,7 +46,7 @@ GN_COMMON_ARGS = [
46
46
  ]
47
47
 
48
48
  _GN_APPLE_COMMON = [
49
- 'enable_dsyms=false',
49
+ 'enable_dsyms=true',
50
50
  'enable_stripping=true',
51
51
  'rtc_enable_symbol_export=false',
52
52
  'rtc_enable_objc_symbol_export=true',
@@ -54,11 +54,8 @@ _GN_APPLE_COMMON = [
54
54
  ]
55
55
 
56
56
  _GN_IOS_ARGS = [
57
- 'enable_ios_bitcode=true',
58
57
  'ios_deployment_target="12.0"',
59
58
  'ios_enable_code_signing=false',
60
- 'use_lld=false',
61
- 'use_custom_libcxx=false',
62
59
  'target_os="ios"',
63
60
  'target_environment="%s"'
64
61
  ]
@@ -233,21 +230,38 @@ def build(target_dir, platform, debug):
233
230
  simulators = [item for item in IOS_BUILD_ARCHS if item.startswith('simulator')]
234
231
  tenv, arch = simulators[0].split(':')
235
232
  gn_out_dir = 'out/%s-ios-%s-%s' % (build_type, tenv, arch)
236
- shutil.copytree(os.path.join(gn_out_dir, 'WebRTC.framework'), os.path.join(gn_out_dir, 'fat-WebRTC.framework'))
237
- out_lib_path = os.path.join(gn_out_dir, 'fat-WebRTC.framework', 'WebRTC')
233
+
234
+ shutil.copytree(os.path.join(gn_out_dir, APPLE_FRAMEWORK_NAME), os.path.join(gn_out_dir, 'fat-' + APPLE_FRAMEWORK_NAME))
235
+ out_lib_path = os.path.join(gn_out_dir, 'fat-' + APPLE_FRAMEWORK_NAME, 'WebRTC')
238
236
  slice_paths = []
239
237
  for item in simulators:
240
238
  tenv, arch = item.split(':')
241
- lib_path = os.path.join('out/%s-ios-%s-%s' % (build_type, tenv, arch), 'WebRTC.framework', 'WebRTC')
239
+ lib_path = os.path.join('out/%s-ios-%s-%s' % (build_type, tenv, arch), APPLE_FRAMEWORK_NAME, 'WebRTC')
242
240
  slice_paths.append(lib_path)
243
241
  sh('lipo %s -create -output %s' % (' '.join(slice_paths), out_lib_path))
244
242
 
245
- orig_framework_path = os.path.join(gn_out_dir, 'WebRTC.framework')
246
- bak_framework_path = os.path.join(gn_out_dir, 'bak-WebRTC.framework')
247
- fat_framework_path = os.path.join(gn_out_dir, 'fat-WebRTC.framework')
243
+ orig_framework_path = os.path.join(gn_out_dir, APPLE_FRAMEWORK_NAME)
244
+ bak_framework_path = os.path.join(gn_out_dir, 'bak-' + APPLE_FRAMEWORK_NAME)
245
+ fat_framework_path = os.path.join(gn_out_dir, 'fat-' + APPLE_FRAMEWORK_NAME)
248
246
  shutil.move(orig_framework_path, bak_framework_path)
249
247
  shutil.move(fat_framework_path, orig_framework_path)
250
248
 
249
+ # dSYMs
250
+ shutil.copytree(os.path.join(gn_out_dir, APPLE_DSYM_NAME), os.path.join(gn_out_dir, 'fat-' + APPLE_DSYM_NAME))
251
+ out_dsym_path = os.path.join(gn_out_dir, 'fat-' + APPLE_DSYM_NAME, 'Contents', 'Resources', 'DWARF', 'WebRTC')
252
+ slice_paths = []
253
+ for item in simulators:
254
+ tenv, arch = item.split(':')
255
+ dsym_path = os.path.join('out/%s-ios-%s-%s' % (build_type, tenv, arch), APPLE_DSYM_NAME, 'Contents', 'Resources', 'DWARF', 'WebRTC')
256
+ slice_paths.append(dsym_path)
257
+ sh('lipo %s -create -output %s' % (' '.join(slice_paths), out_dsym_path))
258
+
259
+ orig_dsym_path = os.path.join(gn_out_dir, APPLE_DSYM_NAME)
260
+ bak_dsym_path = os.path.join(gn_out_dir, 'bak-' + APPLE_DSYM_NAME)
261
+ fat_dsym_path = os.path.join(gn_out_dir, 'fat-' + APPLE_DSYM_NAME)
262
+ shutil.move(orig_dsym_path, bak_dsym_path)
263
+ shutil.move(fat_dsym_path, orig_dsym_path)
264
+
251
265
  _IOS_BUILD_ARCHS = [item for item in IOS_BUILD_ARCHS if not item.startswith('simulator')]
252
266
  _IOS_BUILD_ARCHS.append(simulators[0])
253
267
 
@@ -257,28 +271,13 @@ def build(target_dir, platform, debug):
257
271
  for item in _IOS_BUILD_ARCHS:
258
272
  tenv, arch = item.split(':')
259
273
  gn_out_dir = 'out/%s-ios-%s-%s' % (build_type, tenv, arch)
260
- xcodebuild_cmd += ' -framework %s' % os.path.join(gn_out_dir, 'WebRTC.framework')
261
- #for arch in MACOS_BUILD_ARCHS:
262
- # gn_out_dir = 'out/%s-macos-%s' % (build_type, arch)
263
- # xcodebuild_cmd += ' -framework %s' % os.path.join(gn_out_dir, 'WebRTC.framework')
264
- sh(xcodebuild_cmd)
265
- sh('tar zcf WebRTC.xcframework-bitcode.tgz WebRTC.xcframework', cwd=build_dir)
266
- rmr(xcframework_path)
267
-
268
- # XCFramework (stripped)
269
- xcodebuild_cmd = 'xcodebuild -create-xcframework -output %s' % xcframework_path
270
- bitcode_strip_cmd = 'xcrun bitcode_strip -r %s -o %s'
271
- for item in _IOS_BUILD_ARCHS:
272
- tenv, arch = item.split(':')
273
- gn_out_dir = 'out/%s-ios-%s-%s' % (build_type, tenv, arch)
274
- xcodebuild_cmd += ' -framework %s' % os.path.join(gn_out_dir, 'WebRTC.framework')
275
- framework_path = os.path.join(gn_out_dir, 'WebRTC.framework', 'WebRTC')
276
- sh(bitcode_strip_cmd % (framework_path, framework_path))
274
+ xcodebuild_cmd += ' -framework %s' % os.path.abspath(os.path.join(gn_out_dir, APPLE_FRAMEWORK_NAME))
275
+ xcodebuild_cmd += ' -debug-symbols %s' % os.path.abspath(os.path.join(gn_out_dir, APPLE_DSYM_NAME))
277
276
  #for arch in MACOS_BUILD_ARCHS:
278
277
  # gn_out_dir = 'out/%s-macos-%s' % (build_type, arch)
279
- # xcodebuild_cmd += ' -framework %s' % os.path.join(gn_out_dir, 'WebRTC.framework')
278
+ # xcodebuild_cmd += ' -framework %s' % os.path.join(gn_out_dir, APPLE_FRAMEWORK_NAME)
280
279
  sh(xcodebuild_cmd)
281
- sh('tar zcf WebRTC.xcframework.tgz WebRTC.xcframework', cwd=build_dir)
280
+ sh('zip -r WebRTC.xcframework.zip WebRTC.xcframework', cwd=build_dir)
282
281
  rmr(xcframework_path)
283
282
  else:
284
283
  gn_out_dir = 'out/%s-%s' % (build_type, ANDROID_BUILD_CPUS[0])
@@ -292,7 +291,7 @@ def build(target_dir, platform, debug):
292
291
 
293
292
  sh('jar cvfM libjingle_peerconnection.so.jar lib', cwd=build_dir)
294
293
  rmr(os.path.join(build_dir, 'lib'))
295
- sh('tar zcf android-webrtc.tgz *.jar', cwd=build_dir)
294
+ sh('zip -r android-webrtc.zip *.jar', cwd=build_dir)
296
295
 
297
296
 
298
297
  if __name__ == "__main__":
@@ -1,14 +1,5 @@
1
1
  #!/bin/bash
2
2
 
3
- set -euo pipefail
4
-
5
- THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
6
-
7
- pushd ${THIS_DIR}
8
-
9
- export RN_WEBRTC_BITCODE=1
10
- export RN_WEBRTC_FORCE_DOWNLOAD=1
11
-
12
- node downloadWebRTC.js
13
-
14
- popd
3
+ echo "Bitcode is deprecated since Xcode 14."
4
+ echo "The current WebRTC build already contains bitcode."
5
+ echo "Soon this file will disappear and so will bitcode builds."
@@ -3,6 +3,8 @@ const fs = require('fs');
3
3
  const https = require('https');
4
4
  const path = require('path');
5
5
  const process = require('process');
6
+
7
+ const AdmZip = require('adm-zip');
6
8
  const tar = require('tar');
7
9
 
8
10
  const pkg = require('../package.json');
@@ -53,22 +55,25 @@ async function download(url, filePath) {
53
55
  //
54
56
 
55
57
  if (process.platform === 'darwin') {
56
- const bitcode = process.env.RN_WEBRTC_BITCODE;
57
- const url = bitcode ? builds['ios-bitcode'] : builds['ios'];
58
+ const iosUrl = builds['ios'];
58
59
 
59
- items.push({
60
- url,
61
- dstFileName: 'WebRTC.xcframework.tgz',
62
- dstDir: `${__dirname}/../apple/`
63
- });
60
+ if (iosUrl) {
61
+ items.push({
62
+ url: iosUrl,
63
+ dstFileName: path.basename(iosUrl),
64
+ dstDir: `${__dirname}/../apple/`
65
+ });
66
+ }
64
67
  }
65
68
 
66
69
  // Android
67
70
  //
68
71
 
72
+ const androidUrl = builds['android'];
73
+
69
74
  items.push({
70
- url: builds['android'],
71
- dstFileName: 'android-webrtc.tgz',
75
+ url: androidUrl,
76
+ dstFileName: path.basename(androidUrl),
72
77
  dstDir: `${__dirname}/../android/libs/`
73
78
  });
74
79
 
@@ -88,12 +93,18 @@ async function download(url, filePath) {
88
93
 
89
94
  await download(url, dstPath);
90
95
 
91
- tar.extract({
92
- file: dstPath,
93
- cwd: dstDir,
94
- sync: true,
95
- strict: true
96
- });
96
+ if (path.extname(dstPath) === '.zip') {
97
+ const zip = AdmZip(dstPath);
98
+
99
+ zip.extractAllTo(dstDir, true);
100
+ } else {
101
+ tar.extract({
102
+ file: dstPath,
103
+ cwd: dstDir,
104
+ sync: true,
105
+ strict: true
106
+ });
107
+ }
97
108
 
98
109
  console.log('Done!');
99
110
  }