react-native-webrtc 1.100.1 → 106.0.0-beta.1
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/ISSUE_TEMPLATE.md +17 -13
- package/README.md +46 -129
- package/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java +160 -165
- package/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +279 -0
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +361 -56
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java +5 -1
- package/ios/RCTWebRTC/RCTConvert+WebRTC.m +2 -6
- package/ios/RCTWebRTC/ScreenCapturer.m +0 -1
- package/ios/RCTWebRTC/SerializeUtils.h +25 -0
- package/ios/RCTWebRTC/SerializeUtils.m +219 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +284 -128
- package/ios/RCTWebRTC/WebRTCModule+Transceivers.m +216 -0
- package/ios/RCTWebRTC/WebRTCModule.h +15 -4
- package/ios/RCTWebRTC/WebRTCModule.m +26 -6
- package/lib/commonjs/EventEmitter.js +24 -0
- package/lib/commonjs/EventEmitter.js.map +1 -1
- package/lib/commonjs/Logger.js +65 -0
- package/lib/commonjs/Logger.js.map +1 -0
- package/lib/commonjs/MediaStream.js +1 -1
- package/lib/commonjs/MediaStream.js.map +1 -1
- package/lib/commonjs/MediaStreamTrack.js +4 -2
- package/lib/commonjs/MediaStreamTrack.js.map +1 -1
- package/lib/commonjs/Permissions.js +1 -1
- package/lib/commonjs/Permissions.js.map +1 -1
- package/lib/commonjs/RTCDataChannel.js.map +1 -1
- package/lib/commonjs/RTCErrorEvent.js +33 -0
- package/lib/commonjs/RTCErrorEvent.js.map +1 -0
- package/lib/commonjs/RTCPeerConnection.js +354 -103
- package/lib/commonjs/RTCPeerConnection.js.map +1 -1
- package/lib/commonjs/RTCRtcpParameters.js +24 -0
- package/lib/commonjs/RTCRtcpParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpCapabilities.js +79 -0
- package/lib/commonjs/RTCRtpCapabilities.js.map +1 -0
- package/lib/commonjs/RTCRtpCodecCapability.js +25 -0
- package/lib/commonjs/RTCRtpCodecCapability.js.map +1 -0
- package/lib/commonjs/RTCRtpCodecParameters.js +33 -0
- package/lib/commonjs/RTCRtpCodecParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpEncodingParameters.js +81 -0
- package/lib/commonjs/RTCRtpEncodingParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpHeaderExtension.js +27 -0
- package/lib/commonjs/RTCRtpHeaderExtension.js.map +1 -0
- package/lib/commonjs/RTCRtpParameters.js +26 -0
- package/lib/commonjs/RTCRtpParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpReceiveParameters.js +20 -0
- package/lib/commonjs/RTCRtpReceiveParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpReceiver.js +51 -0
- package/lib/commonjs/RTCRtpReceiver.js.map +1 -0
- package/lib/commonjs/RTCRtpSendParameters.js +60 -0
- package/lib/commonjs/RTCRtpSendParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpSender.js +85 -0
- package/lib/commonjs/RTCRtpSender.js.map +1 -0
- package/lib/commonjs/RTCRtpTransceiver.js +141 -0
- package/lib/commonjs/RTCRtpTransceiver.js.map +1 -0
- package/lib/commonjs/RTCSessionDescription.js.map +1 -1
- package/lib/commonjs/RTCTrackEvent.js +32 -0
- package/lib/commonjs/RTCTrackEvent.js.map +1 -0
- package/lib/commonjs/RTCUtil.js +20 -37
- package/lib/commonjs/RTCUtil.js.map +1 -1
- package/lib/commonjs/getDisplayMedia.js.map +1 -1
- package/lib/commonjs/getUserMedia.js.map +1 -1
- package/lib/commonjs/index.js +127 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/EventEmitter.js +21 -0
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/Logger.js +53 -0
- package/lib/module/Logger.js.map +1 -0
- package/lib/module/MediaStream.js +1 -1
- package/lib/module/MediaStream.js.map +1 -1
- package/lib/module/MediaStreamTrack.js +4 -2
- package/lib/module/MediaStreamTrack.js.map +1 -1
- package/lib/module/Permissions.js +1 -1
- package/lib/module/Permissions.js.map +1 -1
- package/lib/module/RTCDataChannel.js.map +1 -1
- package/lib/module/RTCErrorEvent.js +22 -0
- package/lib/module/RTCErrorEvent.js.map +1 -0
- package/lib/module/RTCPeerConnection.js +348 -103
- package/lib/module/RTCPeerConnection.js.map +1 -1
- package/lib/module/RTCRtcpParameters.js +15 -0
- package/lib/module/RTCRtcpParameters.js.map +1 -0
- package/lib/module/RTCRtpCapabilities.js +63 -0
- package/lib/module/RTCRtpCapabilities.js.map +1 -0
- package/lib/module/RTCRtpCodecCapability.js +16 -0
- package/lib/module/RTCRtpCodecCapability.js.map +1 -0
- package/lib/module/RTCRtpCodecParameters.js +24 -0
- package/lib/module/RTCRtpCodecParameters.js.map +1 -0
- package/lib/module/RTCRtpEncodingParameters.js +72 -0
- package/lib/module/RTCRtpEncodingParameters.js.map +1 -0
- package/lib/module/RTCRtpHeaderExtension.js +18 -0
- package/lib/module/RTCRtpHeaderExtension.js.map +1 -0
- package/lib/module/RTCRtpParameters.js +17 -0
- package/lib/module/RTCRtpParameters.js.map +1 -0
- package/lib/module/RTCRtpReceiveParameters.js +8 -0
- package/lib/module/RTCRtpReceiveParameters.js.map +1 -0
- package/lib/module/RTCRtpReceiver.js +39 -0
- package/lib/module/RTCRtpReceiver.js.map +1 -0
- package/lib/module/RTCRtpSendParameters.js +49 -0
- package/lib/module/RTCRtpSendParameters.js.map +1 -0
- package/lib/module/RTCRtpSender.js +70 -0
- package/lib/module/RTCRtpSender.js.map +1 -0
- package/lib/module/RTCRtpTransceiver.js +125 -0
- package/lib/module/RTCRtpTransceiver.js.map +1 -0
- package/lib/module/RTCSessionDescription.js.map +1 -1
- package/lib/module/RTCTrackEvent.js +23 -0
- package/lib/module/RTCTrackEvent.js.map +1 -0
- package/lib/module/RTCUtil.js +18 -36
- package/lib/module/RTCUtil.js.map +1 -1
- package/lib/module/getDisplayMedia.js.map +1 -1
- package/lib/module/getUserMedia.js.map +1 -1
- package/lib/module/index.js +35 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/EventEmitter.d.ts +3 -0
- package/lib/typescript/Logger.d.ts +13 -0
- package/lib/typescript/MediaDevices.d.ts +2 -2
- package/lib/typescript/MediaStream.d.ts +6 -6
- package/lib/typescript/MediaStreamTrack.d.ts +10 -9
- package/lib/typescript/RTCDataChannel.d.ts +4 -2
- package/lib/typescript/RTCErrorEvent.d.ts +12 -0
- package/lib/typescript/RTCPeerConnection.d.ts +42 -11
- package/lib/typescript/RTCRtcpParameters.d.ts +8 -0
- package/lib/typescript/RTCRtpCapabilities.d.ts +19 -0
- package/lib/typescript/RTCRtpCodecCapability.d.ts +7 -0
- package/lib/typescript/RTCRtpCodecParameters.d.ts +14 -0
- package/lib/typescript/RTCRtpEncodingParameters.d.ts +21 -0
- package/lib/typescript/RTCRtpHeaderExtension.d.ts +10 -0
- package/lib/typescript/RTCRtpParameters.d.ts +14 -0
- package/lib/typescript/RTCRtpReceiveParameters.d.ts +4 -0
- package/lib/typescript/RTCRtpReceiver.d.ts +15 -0
- package/lib/typescript/RTCRtpSendParameters.d.ts +17 -0
- package/lib/typescript/RTCRtpSender.d.ts +21 -0
- package/lib/typescript/RTCRtpTransceiver.d.ts +35 -0
- package/lib/typescript/RTCTrackEvent.d.ts +15 -0
- package/lib/typescript/RTCUtil.d.ts +5 -9
- package/lib/typescript/getDisplayMedia.d.ts +2 -1
- package/lib/typescript/getUserMedia.d.ts +2 -1
- package/lib/typescript/index.d.ts +16 -3
- package/package.json +6 -4
- package/react-native-webrtc.podspec +1 -1
- package/src/EventEmitter.ts +21 -1
- package/src/Logger.ts +49 -0
- package/src/MediaStream.ts +11 -11
- package/src/MediaStreamTrack.ts +14 -13
- package/src/Permissions.ts +1 -1
- package/src/RTCDataChannel.ts +11 -8
- package/src/RTCErrorEvent.ts +21 -0
- package/src/RTCPeerConnection.ts +400 -158
- package/src/RTCRtcpParameters.ts +14 -0
- package/src/RTCRtpCapabilities.ts +54 -0
- package/src/RTCRtpCodecCapability.ts +13 -0
- package/src/RTCRtpCodecParameters.ts +23 -0
- package/src/RTCRtpEncodingParameters.ts +67 -0
- package/src/RTCRtpHeaderExtension.ts +18 -0
- package/src/RTCRtpParameters.ts +21 -0
- package/src/RTCRtpReceiveParameters.ts +7 -0
- package/src/RTCRtpReceiver.ts +35 -0
- package/src/RTCRtpSendParameters.ts +51 -0
- package/src/RTCRtpSender.ts +72 -0
- package/src/RTCRtpTransceiver.ts +125 -0
- package/src/RTCSessionDescription.ts +3 -3
- package/src/RTCTrackEvent.ts +21 -0
- package/src/RTCUtil.ts +20 -40
- package/src/getDisplayMedia.ts +1 -1
- package/src/getUserMedia.ts +2 -2
- package/src/index.ts +51 -6
- package/tools/build-webrtc.py +32 -33
- package/tools/downloadBitcode.sh +2 -12
- package/tools/downloadWebRTC.js +21 -12
package/src/MediaStreamTrack.ts
CHANGED
|
@@ -15,13 +15,14 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
15
15
|
_enabled: boolean;
|
|
16
16
|
_settings: object;
|
|
17
17
|
_muted: boolean;
|
|
18
|
+
_peerConnectionId: number;
|
|
18
19
|
|
|
19
|
-
id: string;
|
|
20
|
-
kind: string;
|
|
21
|
-
label: string;
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly kind: string;
|
|
22
|
+
readonly label: string = "";
|
|
22
23
|
readyState: MediaStreamTrackState;
|
|
23
|
-
remote: boolean;
|
|
24
|
-
|
|
24
|
+
readonly remote: boolean;
|
|
25
|
+
|
|
25
26
|
constructor(info) {
|
|
26
27
|
super();
|
|
27
28
|
|
|
@@ -29,10 +30,10 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
29
30
|
this._enabled = info.enabled;
|
|
30
31
|
this._settings = info.settings || {};
|
|
31
32
|
this._muted = false;
|
|
33
|
+
this._peerConnectionId = info.peerConnectionId;
|
|
32
34
|
|
|
33
35
|
this.id = info.id;
|
|
34
36
|
this.kind = info.kind;
|
|
35
|
-
this.label = info.label;
|
|
36
37
|
this.remote = info.remote;
|
|
37
38
|
|
|
38
39
|
const _readyState = info.readyState.toLowerCase();
|
|
@@ -55,7 +56,7 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
55
56
|
return this._muted;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
stop() {
|
|
59
|
+
stop(): void {
|
|
59
60
|
WebRTCModule.mediaStreamTrackSetEnabled(this.id, false);
|
|
60
61
|
this.readyState = 'ended';
|
|
61
62
|
// TODO: save some stopped flag?
|
|
@@ -68,7 +69,7 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
68
69
|
* This is how the reference application (AppRTCMobile) implements camera
|
|
69
70
|
* switching.
|
|
70
71
|
*/
|
|
71
|
-
_switchCamera() {
|
|
72
|
+
_switchCamera(): void {
|
|
72
73
|
if (this.remote) {
|
|
73
74
|
throw new Error('Not implemented for remote tracks');
|
|
74
75
|
}
|
|
@@ -78,15 +79,15 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
78
79
|
WebRTCModule.mediaStreamTrackSwitchCamera(this.id);
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
applyConstraints() {
|
|
82
|
+
applyConstraints(): never {
|
|
82
83
|
throw new Error('Not implemented.');
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
clone() {
|
|
86
|
+
clone(): never {
|
|
86
87
|
throw new Error('Not implemented.');
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
getCapabilities() {
|
|
90
|
+
getCapabilities(): never {
|
|
90
91
|
throw new Error('Not implemented.');
|
|
91
92
|
}
|
|
92
93
|
|
|
@@ -97,8 +98,8 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
97
98
|
getSettings() {
|
|
98
99
|
return deepClone(this._settings);
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
-
release() {
|
|
101
|
+
|
|
102
|
+
release(): void {
|
|
102
103
|
WebRTCModule.mediaStreamTrackRelease(this.id);
|
|
103
104
|
}
|
|
104
105
|
}
|
package/src/Permissions.ts
CHANGED
|
@@ -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(
|
|
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)
|
package/src/RTCDataChannel.ts
CHANGED
|
@@ -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:
|
|
26
|
+
_subscriptions: any[] = [];
|
|
27
27
|
|
|
28
|
-
binaryType
|
|
29
|
-
bufferedAmount
|
|
30
|
-
bufferedAmountLowThreshold
|
|
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
|
|
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) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import RTCEvent from "./RTCEvent";
|
|
2
|
+
|
|
3
|
+
type RTCPeerConnectionErrorFunc =
|
|
4
|
+
| 'addTransceiver'
|
|
5
|
+
| 'getTransceivers'
|
|
6
|
+
| 'addTrack'
|
|
7
|
+
| 'removeTrack';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @brief This class Represents internal error happening on the native side as
|
|
11
|
+
* part of asynchronous invocations to synchronous web APIs.
|
|
12
|
+
*/
|
|
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
|
+
}
|
|
21
|
+
}
|