react-native-webrtc 106.0.0-beta.1 → 106.0.0-beta.3

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 (147) hide show
  1. package/.eslintignore +6 -0
  2. package/.github/stale.yml +15 -0
  3. package/.github/workflows/ci.yml +17 -0
  4. package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +36 -0
  5. package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +27 -1
  6. package/android/src/main/java/com/oney/WebRTCModule/videoEffects/ProcessorProvider.java +37 -0
  7. package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoEffectProcessor.java +57 -0
  8. package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoFrameProcessor.java +19 -0
  9. package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoFrameProcessorFactoryInterface.java +13 -0
  10. package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +19 -3
  11. package/ios/RCTWebRTC.xcodeproj/project.pbxproj +46 -9
  12. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  13. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  14. package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcuserdata/saghul.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  15. package/ios/RCTWebRTC.xcodeproj/xcuserdata/saghul.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  16. package/ios/RCTWebRTC.xcworkspace/contents.xcworkspacedata +10 -0
  17. package/lib/commonjs/EventEmitter.js.map +1 -1
  18. package/lib/commonjs/Logger.js.map +1 -1
  19. package/lib/commonjs/MediaDevices.js +2 -2
  20. package/lib/commonjs/MediaDevices.js.map +1 -1
  21. package/lib/commonjs/MediaStream.js +3 -3
  22. package/lib/commonjs/MediaStream.js.map +1 -1
  23. package/lib/commonjs/MediaStreamTrack.js +15 -3
  24. package/lib/commonjs/MediaStreamTrack.js.map +1 -1
  25. package/lib/commonjs/Permissions.js +3 -3
  26. package/lib/commonjs/Permissions.js.map +1 -1
  27. package/lib/commonjs/RTCDataChannel.js +6 -5
  28. package/lib/commonjs/RTCDataChannel.js.map +1 -1
  29. package/lib/commonjs/RTCErrorEvent.js +1 -1
  30. package/lib/commonjs/RTCErrorEvent.js.map +1 -1
  31. package/lib/commonjs/RTCPeerConnection.js +166 -61
  32. package/lib/commonjs/RTCPeerConnection.js.map +1 -1
  33. package/lib/commonjs/RTCRtcpParameters.js.map +1 -1
  34. package/lib/commonjs/RTCRtpCapabilities.js +10 -2
  35. package/lib/commonjs/RTCRtpCapabilities.js.map +1 -1
  36. package/lib/commonjs/RTCRtpCodecParameters.js.map +1 -1
  37. package/lib/commonjs/RTCRtpEncodingParameters.js +9 -9
  38. package/lib/commonjs/RTCRtpEncodingParameters.js.map +1 -1
  39. package/lib/commonjs/RTCRtpParameters.js.map +1 -1
  40. package/lib/commonjs/RTCRtpReceiveParameters.js.map +1 -1
  41. package/lib/commonjs/RTCRtpReceiver.js +5 -8
  42. package/lib/commonjs/RTCRtpReceiver.js.map +1 -1
  43. package/lib/commonjs/RTCRtpSendParameters.js +1 -1
  44. package/lib/commonjs/RTCRtpSendParameters.js.map +1 -1
  45. package/lib/commonjs/RTCRtpSender.js +2 -2
  46. package/lib/commonjs/RTCRtpSender.js.map +1 -1
  47. package/lib/commonjs/RTCRtpTransceiver.js.map +1 -1
  48. package/lib/commonjs/RTCSessionDescription.js.map +1 -1
  49. package/lib/commonjs/RTCUtil.js +13 -0
  50. package/lib/commonjs/RTCUtil.js.map +1 -1
  51. package/lib/commonjs/getDisplayMedia.js.map +1 -1
  52. package/lib/commonjs/getUserMedia.js +3 -3
  53. package/lib/commonjs/getUserMedia.js.map +1 -1
  54. package/lib/commonjs/index.js +22 -22
  55. package/lib/commonjs/index.js.map +1 -1
  56. package/lib/module/EventEmitter.js.map +1 -1
  57. package/lib/module/Logger.js.map +1 -1
  58. package/lib/module/MediaDevices.js +1 -1
  59. package/lib/module/MediaDevices.js.map +1 -1
  60. package/lib/module/MediaStream.js +2 -2
  61. package/lib/module/MediaStream.js.map +1 -1
  62. package/lib/module/MediaStreamTrack.js +14 -2
  63. package/lib/module/MediaStreamTrack.js.map +1 -1
  64. package/lib/module/Permissions.js +3 -3
  65. package/lib/module/Permissions.js.map +1 -1
  66. package/lib/module/RTCDataChannel.js +4 -3
  67. package/lib/module/RTCDataChannel.js.map +1 -1
  68. package/lib/module/RTCErrorEvent.js +2 -2
  69. package/lib/module/RTCErrorEvent.js.map +1 -1
  70. package/lib/module/RTCPeerConnection.js +163 -59
  71. package/lib/module/RTCPeerConnection.js.map +1 -1
  72. package/lib/module/RTCRtcpParameters.js.map +1 -1
  73. package/lib/module/RTCRtpCapabilities.js +10 -2
  74. package/lib/module/RTCRtpCapabilities.js.map +1 -1
  75. package/lib/module/RTCRtpCodecParameters.js.map +1 -1
  76. package/lib/module/RTCRtpEncodingParameters.js +9 -9
  77. package/lib/module/RTCRtpEncodingParameters.js.map +1 -1
  78. package/lib/module/RTCRtpParameters.js.map +1 -1
  79. package/lib/module/RTCRtpReceiveParameters.js +1 -1
  80. package/lib/module/RTCRtpReceiveParameters.js.map +1 -1
  81. package/lib/module/RTCRtpReceiver.js +5 -6
  82. package/lib/module/RTCRtpReceiver.js.map +1 -1
  83. package/lib/module/RTCRtpSendParameters.js +2 -2
  84. package/lib/module/RTCRtpSendParameters.js.map +1 -1
  85. package/lib/module/RTCRtpSender.js +2 -2
  86. package/lib/module/RTCRtpSender.js.map +1 -1
  87. package/lib/module/RTCRtpTransceiver.js.map +1 -1
  88. package/lib/module/RTCSessionDescription.js.map +1 -1
  89. package/lib/module/RTCUtil.js +11 -0
  90. package/lib/module/RTCUtil.js.map +1 -1
  91. package/lib/module/getDisplayMedia.js.map +1 -1
  92. package/lib/module/getUserMedia.js +1 -1
  93. package/lib/module/getUserMedia.js.map +1 -1
  94. package/lib/module/index.js +14 -14
  95. package/lib/module/index.js.map +1 -1
  96. package/lib/typescript/EventEmitter.d.ts +4 -3
  97. package/lib/typescript/MediaStreamTrack.d.ts +1 -0
  98. package/lib/typescript/Permissions.d.ts +1 -1
  99. package/lib/typescript/RTCDataChannel.d.ts +2 -1
  100. package/lib/typescript/RTCErrorEvent.d.ts +1 -1
  101. package/lib/typescript/RTCPeerConnection.d.ts +6 -7
  102. package/lib/typescript/RTCRtpCodecParameters.d.ts +2 -2
  103. package/lib/typescript/RTCRtpEncodingParameters.d.ts +2 -2
  104. package/lib/typescript/RTCRtpParameters.d.ts +3 -3
  105. package/lib/typescript/RTCRtpReceiveParameters.d.ts +1 -1
  106. package/lib/typescript/RTCRtpReceiver.d.ts +1 -1
  107. package/lib/typescript/RTCRtpSendParameters.d.ts +2 -2
  108. package/lib/typescript/RTCRtpSender.d.ts +1 -1
  109. package/lib/typescript/RTCRtpTransceiver.d.ts +1 -1
  110. package/lib/typescript/RTCSessionDescription.d.ts +6 -8
  111. package/lib/typescript/RTCUtil.d.ts +7 -0
  112. package/lib/typescript/index.d.ts +12 -12
  113. package/package.json +7 -4
  114. package/react-native-webrtc.podspec +1 -2
  115. package/src/.eslintrc.cjs +67 -0
  116. package/src/EventEmitter.ts +5 -4
  117. package/src/Logger.ts +1 -1
  118. package/src/MediaDevices.ts +2 -2
  119. package/src/MediaStream.ts +13 -4
  120. package/src/MediaStreamTrack.ts +21 -5
  121. package/src/Permissions.ts +12 -5
  122. package/src/RTCDataChannel.ts +17 -5
  123. package/src/RTCErrorEvent.ts +9 -9
  124. package/src/RTCPeerConnection.ts +213 -92
  125. package/src/RTCRtcpParameters.ts +7 -7
  126. package/src/RTCRtpCapabilities.ts +15 -4
  127. package/src/RTCRtpCodecParameters.ts +2 -2
  128. package/src/RTCRtpEncodingParameters.ts +19 -17
  129. package/src/RTCRtpParameters.ts +3 -3
  130. package/src/RTCRtpReceiveParameters.ts +1 -2
  131. package/src/RTCRtpReceiver.ts +7 -7
  132. package/src/RTCRtpSendParameters.ts +10 -8
  133. package/src/RTCRtpSender.ts +11 -9
  134. package/src/RTCRtpTransceiver.ts +11 -7
  135. package/src/RTCSessionDescription.ts +7 -2
  136. package/src/RTCUtil.ts +24 -4
  137. package/src/getDisplayMedia.ts +1 -1
  138. package/src/getUserMedia.ts +9 -2
  139. package/src/index.ts +16 -14
  140. package/tools/downloadWebRTC.js +7 -5
  141. package/.prettierignore +0 -9
  142. package/.prettierrc.json +0 -10
  143. package/lib/commonjs/typings.d.js +0 -2
  144. package/lib/commonjs/typings.d.js.map +0 -1
  145. package/lib/module/typings.d.js +0 -2
  146. package/lib/module/typings.d.js.map +0 -1
  147. package/src/typings.d.ts +0 -1
@@ -1,16 +1,17 @@
1
1
 
2
- import { NativeModules } from 'react-native';
3
2
  import * as base64 from 'base64-js';
4
3
  import { defineCustomEventTarget } from 'event-target-shim';
4
+ import { EmitterSubscription, NativeModules } from 'react-native';
5
+
6
+ import EventEmitter from './EventEmitter';
5
7
  import MessageEvent from './MessageEvent';
6
8
  import RTCDataChannelEvent from './RTCDataChannelEvent';
7
- import EventEmitter from './EventEmitter';
8
9
 
9
10
  const { WebRTCModule } = NativeModules;
10
11
 
11
12
  type RTCDataChannelState = 'connecting' | 'open' | 'closing' | 'closed';
12
13
 
13
- const DATA_CHANNEL_EVENTS = ['open', 'message', 'bufferedamountlow', 'closing', 'close', 'error'];
14
+ const DATA_CHANNEL_EVENTS = [ 'open', 'message', 'bufferedamountlow', 'closing', 'close', 'error' ];
14
15
 
15
16
  export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHANNEL_EVENTS) {
16
17
  _peerConnectionId: number;
@@ -23,7 +24,7 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
23
24
  _ordered: boolean;
24
25
  _protocol: string;
25
26
  _readyState: RTCDataChannelState;
26
- _subscriptions: any[] = [];
27
+ _subscriptions: EmitterSubscription[] = [];
27
28
 
28
29
  binaryType = 'arraybuffer'; // we only support 'arraybuffer'
29
30
  bufferedAmount = 0;
@@ -85,6 +86,7 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
85
86
  send(data: string | ArrayBuffer | ArrayBufferView): void {
86
87
  if (typeof data === 'string') {
87
88
  WebRTCModule.dataChannelSend(this._peerConnectionId, this._reactTag, data, 'text');
89
+
88
90
  return;
89
91
  }
90
92
 
@@ -96,13 +98,17 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
96
98
  } else {
97
99
  throw new TypeError('Data must be either string, ArrayBuffer, or ArrayBufferView');
98
100
  }
99
- WebRTCModule.dataChannelSend(this._peerConnectionId, this._reactTag, base64.fromByteArray(data as Uint8Array), 'binary');
101
+
102
+ const base64data = base64.fromByteArray(data as Uint8Array);
103
+
104
+ WebRTCModule.dataChannelSend(this._peerConnectionId, this._reactTag, base64data, 'binary');
100
105
  }
101
106
 
102
107
  close(): void {
103
108
  if (this._readyState === 'closing' || this._readyState === 'closed') {
104
109
  return;
105
110
  }
111
+
106
112
  WebRTCModule.dataChannelClose(this._peerConnectionId, this._reactTag);
107
113
  }
108
114
 
@@ -117,10 +123,13 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
117
123
  if (ev.reactTag !== this._reactTag) {
118
124
  return;
119
125
  }
126
+
120
127
  this._readyState = ev.state;
128
+
121
129
  if (this._id === null && ev.id !== -1) {
122
130
  this._id = ev.id;
123
131
  }
132
+
124
133
  if (this._readyState === 'open') {
125
134
  // @ts-ignore
126
135
  this.dispatchEvent(new RTCDataChannelEvent('open', { channel: this }));
@@ -138,10 +147,13 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
138
147
  if (ev.reactTag !== this._reactTag) {
139
148
  return;
140
149
  }
150
+
141
151
  let data = ev.data;
152
+
142
153
  if (ev.type === 'binary') {
143
154
  data = base64.toByteArray(ev.data).buffer;
144
155
  }
156
+
145
157
  // @ts-ignore
146
158
  this.dispatchEvent(new MessageEvent('message', { data }));
147
159
  })
@@ -1,4 +1,4 @@
1
- import RTCEvent from "./RTCEvent";
1
+ import RTCEvent from './RTCEvent';
2
2
 
3
3
  type RTCPeerConnectionErrorFunc =
4
4
  | 'addTransceiver'
@@ -8,14 +8,14 @@ type RTCPeerConnectionErrorFunc =
8
8
 
9
9
  /**
10
10
  * @brief This class Represents internal error happening on the native side as
11
- * part of asynchronous invocations to synchronous web APIs.
11
+ * part of asynchronous invocations to synchronous web APIs.
12
12
  */
13
13
  export default class RTCErrorEvent extends RTCEvent {
14
- readonly func: RTCPeerConnectionErrorFunc;
15
- readonly message: string;
16
- constructor(type: string, func: RTCPeerConnectionErrorFunc, message: string) {
17
- super(type);
18
- this.func = func;
19
- this.message = message;
20
- }
14
+ readonly func: RTCPeerConnectionErrorFunc;
15
+ readonly message: string;
16
+ constructor(type: string, func: RTCPeerConnectionErrorFunc, message: string) {
17
+ super(type);
18
+ this.func = func;
19
+ this.message = message;
20
+ }
21
21
  }