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.
- package/.eslintignore +6 -0
- package/.github/stale.yml +15 -0
- package/.github/workflows/ci.yml +17 -0
- package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +36 -0
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +27 -1
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/ProcessorProvider.java +37 -0
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoEffectProcessor.java +57 -0
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoFrameProcessor.java +19 -0
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoFrameProcessorFactoryInterface.java +13 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +19 -3
- package/ios/RCTWebRTC.xcodeproj/project.pbxproj +46 -9
- package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/RCTWebRTC.xcodeproj/project.xcworkspace/xcuserdata/saghul.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RCTWebRTC.xcodeproj/xcuserdata/saghul.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/RCTWebRTC.xcworkspace/contents.xcworkspacedata +10 -0
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/Logger.js.map +1 -1
- package/lib/commonjs/MediaDevices.js +2 -2
- package/lib/commonjs/MediaDevices.js.map +1 -1
- package/lib/commonjs/MediaStream.js +3 -3
- package/lib/commonjs/MediaStream.js.map +1 -1
- package/lib/commonjs/MediaStreamTrack.js +15 -3
- package/lib/commonjs/MediaStreamTrack.js.map +1 -1
- package/lib/commonjs/Permissions.js +3 -3
- package/lib/commonjs/Permissions.js.map +1 -1
- package/lib/commonjs/RTCDataChannel.js +6 -5
- package/lib/commonjs/RTCDataChannel.js.map +1 -1
- package/lib/commonjs/RTCErrorEvent.js +1 -1
- package/lib/commonjs/RTCErrorEvent.js.map +1 -1
- package/lib/commonjs/RTCPeerConnection.js +166 -61
- package/lib/commonjs/RTCPeerConnection.js.map +1 -1
- package/lib/commonjs/RTCRtcpParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpCapabilities.js +10 -2
- package/lib/commonjs/RTCRtpCapabilities.js.map +1 -1
- package/lib/commonjs/RTCRtpCodecParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpEncodingParameters.js +9 -9
- package/lib/commonjs/RTCRtpEncodingParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpReceiveParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpReceiver.js +5 -8
- package/lib/commonjs/RTCRtpReceiver.js.map +1 -1
- package/lib/commonjs/RTCRtpSendParameters.js +1 -1
- package/lib/commonjs/RTCRtpSendParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpSender.js +2 -2
- package/lib/commonjs/RTCRtpSender.js.map +1 -1
- package/lib/commonjs/RTCRtpTransceiver.js.map +1 -1
- package/lib/commonjs/RTCSessionDescription.js.map +1 -1
- package/lib/commonjs/RTCUtil.js +13 -0
- package/lib/commonjs/RTCUtil.js.map +1 -1
- package/lib/commonjs/getDisplayMedia.js.map +1 -1
- package/lib/commonjs/getUserMedia.js +3 -3
- package/lib/commonjs/getUserMedia.js.map +1 -1
- package/lib/commonjs/index.js +22 -22
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/Logger.js.map +1 -1
- package/lib/module/MediaDevices.js +1 -1
- package/lib/module/MediaDevices.js.map +1 -1
- package/lib/module/MediaStream.js +2 -2
- package/lib/module/MediaStream.js.map +1 -1
- package/lib/module/MediaStreamTrack.js +14 -2
- package/lib/module/MediaStreamTrack.js.map +1 -1
- package/lib/module/Permissions.js +3 -3
- package/lib/module/Permissions.js.map +1 -1
- package/lib/module/RTCDataChannel.js +4 -3
- package/lib/module/RTCDataChannel.js.map +1 -1
- package/lib/module/RTCErrorEvent.js +2 -2
- package/lib/module/RTCErrorEvent.js.map +1 -1
- package/lib/module/RTCPeerConnection.js +163 -59
- package/lib/module/RTCPeerConnection.js.map +1 -1
- package/lib/module/RTCRtcpParameters.js.map +1 -1
- package/lib/module/RTCRtpCapabilities.js +10 -2
- package/lib/module/RTCRtpCapabilities.js.map +1 -1
- package/lib/module/RTCRtpCodecParameters.js.map +1 -1
- package/lib/module/RTCRtpEncodingParameters.js +9 -9
- package/lib/module/RTCRtpEncodingParameters.js.map +1 -1
- package/lib/module/RTCRtpParameters.js.map +1 -1
- package/lib/module/RTCRtpReceiveParameters.js +1 -1
- package/lib/module/RTCRtpReceiveParameters.js.map +1 -1
- package/lib/module/RTCRtpReceiver.js +5 -6
- package/lib/module/RTCRtpReceiver.js.map +1 -1
- package/lib/module/RTCRtpSendParameters.js +2 -2
- package/lib/module/RTCRtpSendParameters.js.map +1 -1
- package/lib/module/RTCRtpSender.js +2 -2
- package/lib/module/RTCRtpSender.js.map +1 -1
- package/lib/module/RTCRtpTransceiver.js.map +1 -1
- package/lib/module/RTCSessionDescription.js.map +1 -1
- package/lib/module/RTCUtil.js +11 -0
- package/lib/module/RTCUtil.js.map +1 -1
- package/lib/module/getDisplayMedia.js.map +1 -1
- package/lib/module/getUserMedia.js +1 -1
- package/lib/module/getUserMedia.js.map +1 -1
- package/lib/module/index.js +14 -14
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/EventEmitter.d.ts +4 -3
- package/lib/typescript/MediaStreamTrack.d.ts +1 -0
- package/lib/typescript/Permissions.d.ts +1 -1
- package/lib/typescript/RTCDataChannel.d.ts +2 -1
- package/lib/typescript/RTCErrorEvent.d.ts +1 -1
- package/lib/typescript/RTCPeerConnection.d.ts +6 -7
- package/lib/typescript/RTCRtpCodecParameters.d.ts +2 -2
- package/lib/typescript/RTCRtpEncodingParameters.d.ts +2 -2
- package/lib/typescript/RTCRtpParameters.d.ts +3 -3
- package/lib/typescript/RTCRtpReceiveParameters.d.ts +1 -1
- package/lib/typescript/RTCRtpReceiver.d.ts +1 -1
- package/lib/typescript/RTCRtpSendParameters.d.ts +2 -2
- package/lib/typescript/RTCRtpSender.d.ts +1 -1
- package/lib/typescript/RTCRtpTransceiver.d.ts +1 -1
- package/lib/typescript/RTCSessionDescription.d.ts +6 -8
- package/lib/typescript/RTCUtil.d.ts +7 -0
- package/lib/typescript/index.d.ts +12 -12
- package/package.json +7 -4
- package/react-native-webrtc.podspec +1 -2
- package/src/.eslintrc.cjs +67 -0
- package/src/EventEmitter.ts +5 -4
- package/src/Logger.ts +1 -1
- package/src/MediaDevices.ts +2 -2
- package/src/MediaStream.ts +13 -4
- package/src/MediaStreamTrack.ts +21 -5
- package/src/Permissions.ts +12 -5
- package/src/RTCDataChannel.ts +17 -5
- package/src/RTCErrorEvent.ts +9 -9
- package/src/RTCPeerConnection.ts +213 -92
- package/src/RTCRtcpParameters.ts +7 -7
- package/src/RTCRtpCapabilities.ts +15 -4
- package/src/RTCRtpCodecParameters.ts +2 -2
- package/src/RTCRtpEncodingParameters.ts +19 -17
- package/src/RTCRtpParameters.ts +3 -3
- package/src/RTCRtpReceiveParameters.ts +1 -2
- package/src/RTCRtpReceiver.ts +7 -7
- package/src/RTCRtpSendParameters.ts +10 -8
- package/src/RTCRtpSender.ts +11 -9
- package/src/RTCRtpTransceiver.ts +11 -7
- package/src/RTCSessionDescription.ts +7 -2
- package/src/RTCUtil.ts +24 -4
- package/src/getDisplayMedia.ts +1 -1
- package/src/getUserMedia.ts +9 -2
- package/src/index.ts +16 -14
- package/tools/downloadWebRTC.js +7 -5
- package/.prettierignore +0 -9
- package/.prettierrc.json +0 -10
- package/lib/commonjs/typings.d.js +0 -2
- package/lib/commonjs/typings.d.js.map +0 -1
- package/lib/module/typings.d.js +0 -2
- package/lib/module/typings.d.js.map +0 -1
- package/src/typings.d.ts +0 -1
package/src/RTCDataChannel.ts
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
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
|
})
|
package/src/RTCErrorEvent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import RTCEvent from
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
}
|