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
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineCustomEventTarget
|
|
1
|
+
import { defineCustomEventTarget } from 'event-target-shim';
|
|
2
2
|
import MediaStream from './MediaStream';
|
|
3
3
|
import MediaStreamTrack from './MediaStreamTrack';
|
|
4
|
-
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
5
4
|
import RTCDataChannel from './RTCDataChannel';
|
|
6
|
-
import RTCSessionDescription from './RTCSessionDescription';
|
|
7
5
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
8
6
|
import RTCRtpSender from './RTCRtpSender';
|
|
7
|
+
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
8
|
+
import RTCSessionDescription, { RTCSessionDescriptionInit } from './RTCSessionDescription';
|
|
9
9
|
declare type RTCSignalingState = 'stable' | 'have-local-offer' | 'have-remote-offer' | 'have-local-pranswer' | 'have-remote-pranswer' | 'closed';
|
|
10
10
|
declare type RTCIceGatheringState = 'new' | 'gathering' | 'complete';
|
|
11
11
|
declare type RTCPeerConnectionState = 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed';
|
|
@@ -18,7 +18,7 @@ declare type RTCDataChannelInit = {
|
|
|
18
18
|
negotiated?: boolean;
|
|
19
19
|
id?: number;
|
|
20
20
|
};
|
|
21
|
-
declare const RTCPeerConnection_base: defineCustomEventTarget.CustomEventTargetConstructor<Record<string, Event<string>>, "standard">;
|
|
21
|
+
declare const RTCPeerConnection_base: defineCustomEventTarget.CustomEventTargetConstructor<Record<string, import("event-target-shim").Event<string>>, "standard">;
|
|
22
22
|
export default class RTCPeerConnection extends RTCPeerConnection_base {
|
|
23
23
|
localDescription: RTCSessionDescription | null;
|
|
24
24
|
remoteDescription: RTCSessionDescription | null;
|
|
@@ -27,7 +27,6 @@ export default class RTCPeerConnection extends RTCPeerConnection_base {
|
|
|
27
27
|
connectionState: RTCPeerConnectionState;
|
|
28
28
|
iceConnectionState: RTCIceConnectionState;
|
|
29
29
|
_peerConnectionId: number;
|
|
30
|
-
_subscriptions: any[];
|
|
31
30
|
_transceivers: {
|
|
32
31
|
order: number;
|
|
33
32
|
transceiver: RTCRtpTransceiver;
|
|
@@ -37,8 +36,8 @@ export default class RTCPeerConnection extends RTCPeerConnection_base {
|
|
|
37
36
|
createOffer(options: any): Promise<unknown>;
|
|
38
37
|
createAnswer(): Promise<unknown>;
|
|
39
38
|
setConfiguration(configuration: any): void;
|
|
40
|
-
setLocalDescription(sessionDescription?: RTCSessionDescription): Promise<void>;
|
|
41
|
-
setRemoteDescription(sessionDescription: RTCSessionDescription): Promise<void>;
|
|
39
|
+
setLocalDescription(sessionDescription?: RTCSessionDescription | RTCSessionDescriptionInit): Promise<void>;
|
|
40
|
+
setRemoteDescription(sessionDescription: RTCSessionDescription | RTCSessionDescriptionInit): Promise<void>;
|
|
42
41
|
addIceCandidate(candidate: any): Promise<void>;
|
|
43
42
|
/**
|
|
44
43
|
* @brief Adds a new track to the {@link RTCPeerConnection},
|
|
@@ -3,12 +3,12 @@ export default class RTCRtpCodecParameters {
|
|
|
3
3
|
readonly clockRate: number;
|
|
4
4
|
readonly channels: number;
|
|
5
5
|
readonly mimeType: string;
|
|
6
|
-
readonly sdpFmtpLine: Map<
|
|
6
|
+
readonly sdpFmtpLine: Map<string, string>;
|
|
7
7
|
constructor(init: {
|
|
8
8
|
payloadType: number;
|
|
9
9
|
clockRate: number;
|
|
10
10
|
channels: number;
|
|
11
11
|
mimeType: string;
|
|
12
|
-
sdpFmtpLine: Map<
|
|
12
|
+
sdpFmtpLine: Map<string, string>;
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -10,10 +10,10 @@ export default class RTCRtpEncodingParameters {
|
|
|
10
10
|
scaleResolutionDownBy?: number;
|
|
11
11
|
});
|
|
12
12
|
get maxFramerate(): number | null;
|
|
13
|
-
get maxBitrate(): number | null;
|
|
14
|
-
get scaleResolutionDownBy(): number | null;
|
|
15
13
|
set maxFramerate(framerate: number | null);
|
|
14
|
+
get maxBitrate(): number | null;
|
|
16
15
|
set maxBitrate(bitrate: number | null);
|
|
16
|
+
get scaleResolutionDownBy(): number | null;
|
|
17
17
|
set scaleResolutionDownBy(resolutionScale: number | null);
|
|
18
18
|
toJSON(): {
|
|
19
19
|
active: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import RTCRtcpParameters from
|
|
2
|
-
import RTCRtpCodecParameters from
|
|
3
|
-
import RTCRtpHeaderExtension from
|
|
1
|
+
import RTCRtcpParameters from './RTCRtcpParameters';
|
|
2
|
+
import RTCRtpCodecParameters from './RTCRtpCodecParameters';
|
|
3
|
+
import RTCRtpHeaderExtension from './RTCRtpHeaderExtension';
|
|
4
4
|
export declare type RTCRtpParametersInit = {
|
|
5
5
|
codecs: RTCRtpCodecParameters[];
|
|
6
6
|
headerExtensions: RTCRtpHeaderExtension[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import RTCRtpParameters, { RTCRtpParametersInit } from
|
|
1
|
+
import RTCRtpParameters, { RTCRtpParametersInit } from './RTCRtpParameters';
|
|
2
2
|
export default class RTCRtpReceiveParameters extends RTCRtpParameters {
|
|
3
3
|
constructor(init: RTCRtpParametersInit);
|
|
4
4
|
}
|
|
@@ -9,7 +9,7 @@ export default class RTCRtpReceiver {
|
|
|
9
9
|
id: string;
|
|
10
10
|
track: MediaStreamTrack;
|
|
11
11
|
});
|
|
12
|
-
static getCapabilities(kind:
|
|
12
|
+
static getCapabilities(kind: 'audio' | 'video'): RTCRtpCapabilities;
|
|
13
13
|
get id(): string;
|
|
14
14
|
get track(): MediaStreamTrack;
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import RTCRtpEncodingParameters from './RTCRtpEncodingParameters';
|
|
2
|
+
import RTCRtpParameters, { RTCRtpParametersInit } from './RTCRtpParameters';
|
|
3
3
|
declare type DegradationPreferenceType = 'maintain-framerate' | 'maintain-resolution' | 'balanced' | 'disabled';
|
|
4
4
|
export default class RTCRtpSendParameters extends RTCRtpParameters {
|
|
5
5
|
readonly transactionId: string;
|
|
@@ -13,7 +13,7 @@ export default class RTCRtpSender {
|
|
|
13
13
|
rtpParameters: RTCRtpSendParameters;
|
|
14
14
|
});
|
|
15
15
|
replaceTrack(track: MediaStreamTrack | null): Promise<void>;
|
|
16
|
-
static getCapabilities(kind:
|
|
16
|
+
static getCapabilities(kind: 'audio' | 'video'): RTCRtpCapabilities;
|
|
17
17
|
getParameters(): RTCRtpSendParameters;
|
|
18
18
|
setParameters(parameters: RTCRtpSendParameters): Promise<void>;
|
|
19
19
|
get track(): MediaStreamTrack | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineCustomEventTarget } from 'event-target-shim';
|
|
2
|
-
import RTCRtpSender from './RTCRtpSender';
|
|
3
2
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
3
|
+
import RTCRtpSender from './RTCRtpSender';
|
|
4
4
|
declare const RTCRtpTransceiver_base: defineCustomEventTarget.CustomEventTargetConstructor<Record<string, import("event-target-shim").Event<string>>, "standard">;
|
|
5
5
|
export default class RTCRtpTransceiver extends RTCRtpTransceiver_base {
|
|
6
6
|
_peerConnectionId: number;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
+
export interface RTCSessionDescriptionInit {
|
|
2
|
+
sdp: string;
|
|
3
|
+
type: string | null;
|
|
4
|
+
}
|
|
1
5
|
export default class RTCSessionDescription {
|
|
2
6
|
_sdp: string;
|
|
3
7
|
_type: string | null;
|
|
4
|
-
constructor(info?:
|
|
5
|
-
type: null;
|
|
6
|
-
sdp: string;
|
|
7
|
-
});
|
|
8
|
+
constructor(info?: RTCSessionDescriptionInit);
|
|
8
9
|
get sdp(): string;
|
|
9
10
|
get type(): string | null;
|
|
10
|
-
toJSON():
|
|
11
|
-
sdp: string;
|
|
12
|
-
type: string | null;
|
|
13
|
-
};
|
|
11
|
+
toJSON(): RTCSessionDescriptionInit;
|
|
14
12
|
}
|
|
@@ -11,6 +11,13 @@ export declare function uniqueID(): string;
|
|
|
11
11
|
* @return {Object} cloned obj
|
|
12
12
|
*/
|
|
13
13
|
export declare function deepClone<T>(obj: T): T;
|
|
14
|
+
/**
|
|
15
|
+
* Checks whether an SDP type is valid or not.
|
|
16
|
+
*
|
|
17
|
+
* @param type SDP type to check.
|
|
18
|
+
* @returns Whether the SDP type is valid or not.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isSdpTypeValid(type: string): boolean;
|
|
14
21
|
/**
|
|
15
22
|
* Normalize options passed to createOffer().
|
|
16
23
|
*
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
+
import mediaDevices from './MediaDevices';
|
|
2
|
+
import MediaStream from './MediaStream';
|
|
3
|
+
import MediaStreamTrack from './MediaStreamTrack';
|
|
4
|
+
import permissions from './Permissions';
|
|
5
|
+
import RTCErrorEvent from './RTCErrorEvent';
|
|
1
6
|
import RTCIceCandidate from './RTCIceCandidate';
|
|
2
7
|
import RTCPeerConnection from './RTCPeerConnection';
|
|
3
|
-
import
|
|
4
|
-
import RTCRtpSender from './RTCRtpSender';
|
|
5
|
-
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
8
|
+
import RTCRtcpParameters from './RTCRtcpParameters';
|
|
6
9
|
import RTCRtpCapabilities from './RTCRtpCapabilities';
|
|
7
10
|
import RTCRtpCodecCapability from './RTCRtpCodecCapability';
|
|
8
|
-
import RTCRtpEncodingParameters from './RTCRtpEncodingParameters';
|
|
9
11
|
import RTCRtpCodecParameters from './RTCRtpCodecParameters';
|
|
10
|
-
import
|
|
11
|
-
import RTCRtcpParameters from './RTCRtcpParameters';
|
|
12
|
+
import RTCRtpEncodingParameters from './RTCRtpEncodingParameters';
|
|
12
13
|
import RTCRtpHeaderExtension from './RTCRtpHeaderExtension';
|
|
13
|
-
import
|
|
14
|
+
import RTCRtpParameters from './RTCRtpParameters';
|
|
14
15
|
import RTCRtpReceiveParameters from './RTCRtpReceiveParameters';
|
|
16
|
+
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
17
|
+
import RTCRtpSendParameters from './RTCRtpSendParameters';
|
|
18
|
+
import RTCRtpSender from './RTCRtpSender';
|
|
19
|
+
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
15
20
|
import RTCSessionDescription from './RTCSessionDescription';
|
|
16
|
-
import RTCErrorEvent from './RTCErrorEvent';
|
|
17
21
|
import RTCView from './RTCView';
|
|
18
22
|
import ScreenCapturePickerView from './ScreenCapturePickerView';
|
|
19
|
-
import MediaStream from './MediaStream';
|
|
20
|
-
import MediaStreamTrack from './MediaStreamTrack';
|
|
21
|
-
import mediaDevices from './MediaDevices';
|
|
22
|
-
import permissions from './Permissions';
|
|
23
23
|
export { RTCIceCandidate, RTCPeerConnection, RTCSessionDescription, RTCView, ScreenCapturePickerView, RTCRtpTransceiver, RTCRtpReceiver, RTCRtpSender, RTCErrorEvent, RTCRtpCapabilities, RTCRtpCodecCapability, RTCRtpCodecParameters, RTCRtpEncodingParameters, RTCRtpParameters, RTCRtpSendParameters, RTCRtpReceiveParameters, RTCRtcpParameters, RTCRtpHeaderExtension, MediaStream, MediaStreamTrack, mediaDevices, permissions, registerGlobals };
|
|
24
24
|
declare function registerGlobals(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-webrtc",
|
|
3
|
-
"version": "106.0.0-beta.
|
|
3
|
+
"version": "106.0.0-beta.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/react-native-webrtc/react-native-webrtc.git"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"react-native": ">=0.60.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"
|
|
33
|
+
"lint": "eslint --max-warnings 0 . && tsc --noEmit",
|
|
34
34
|
"postinstall": "node tools/downloadWebRTC.js",
|
|
35
35
|
"prepare": "husky install && bob build"
|
|
36
36
|
},
|
|
@@ -41,6 +41,10 @@
|
|
|
41
41
|
"@types/debug": "4.1.7",
|
|
42
42
|
"@types/react": "17.0.40",
|
|
43
43
|
"@types/react-native": "0.67.3",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^5.39.0",
|
|
45
|
+
"@typescript-eslint/parser": "^5.39.0",
|
|
46
|
+
"eslint": "^8.24.0",
|
|
47
|
+
"eslint-plugin-import": "^2.26.0",
|
|
44
48
|
"husky": "7.0.2",
|
|
45
49
|
"lint-staged": "11.2.3",
|
|
46
50
|
"prettier": "2.4.1",
|
|
@@ -60,7 +64,6 @@
|
|
|
60
64
|
]
|
|
61
65
|
},
|
|
62
66
|
"webrtc-builds": {
|
|
63
|
-
"android": "https://github.com/jitsi/webrtc/releases/download/v106.0.0
|
|
64
|
-
"ios": "https://github.com/jitsi/webrtc/releases/download/v106.0.0-rc.1/WebRTC.xcframework.zip"
|
|
67
|
+
"android": "https://github.com/jitsi/webrtc/releases/download/v106.0.0/android-webrtc.zip"
|
|
65
68
|
}
|
|
66
69
|
}
|
|
@@ -18,7 +18,6 @@ Pod::Spec.new do |s|
|
|
|
18
18
|
s.source_files = 'ios/**/*.{h,m}'
|
|
19
19
|
s.libraries = 'c', 'sqlite3', 'stdc++'
|
|
20
20
|
s.framework = 'AudioToolbox','AVFoundation', 'CoreAudio', 'CoreGraphics', 'CoreVideo', 'GLKit', 'VideoToolbox'
|
|
21
|
-
s.ios.vendored_frameworks = 'apple/WebRTC.xcframework'
|
|
22
|
-
s.macos.vendored_frameworks = 'apple/WebRTC.xcframework'
|
|
23
21
|
s.dependency 'React-Core'
|
|
22
|
+
s.dependency 'JitsiWebRTC', '~> 106.0.0'
|
|
24
23
|
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
|
5
|
+
parser: '@typescript-eslint/parser',
|
|
6
|
+
plugins: ['@typescript-eslint', 'eslint-plugin-import'],
|
|
7
|
+
root: true,
|
|
8
|
+
overrides: [
|
|
9
|
+
{
|
|
10
|
+
files: [ '*.ts' ],
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
13
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
rules: {
|
|
18
|
+
'arrow-body-style': [
|
|
19
|
+
'error',
|
|
20
|
+
'as-needed',
|
|
21
|
+
{ requireReturnForObjectLiteral: true }
|
|
22
|
+
],
|
|
23
|
+
'array-bracket-spacing': [
|
|
24
|
+
'error',
|
|
25
|
+
'always',
|
|
26
|
+
{ 'objectsInArrays': true }
|
|
27
|
+
],
|
|
28
|
+
'arrow-parens': [ 'error', 'as-needed' ],
|
|
29
|
+
'block-spacing': [ 'error', 'always' ],
|
|
30
|
+
'brace-style': 'error',
|
|
31
|
+
'curly': 'error',
|
|
32
|
+
'eqeqeq': 'error',
|
|
33
|
+
'import/no-duplicates': 'error',
|
|
34
|
+
'import/order': [ 'error', {
|
|
35
|
+
'alphabetize': {
|
|
36
|
+
'order': 'asc'
|
|
37
|
+
},
|
|
38
|
+
'groups': [ [ 'builtin', 'external' ], 'parent', 'sibling', 'index' ],
|
|
39
|
+
'newlines-between': 'always'
|
|
40
|
+
} ],
|
|
41
|
+
'indent': [
|
|
42
|
+
'error',
|
|
43
|
+
4,
|
|
44
|
+
{ 'SwitchCase': 1 }
|
|
45
|
+
],
|
|
46
|
+
'keyword-spacing': 'error',
|
|
47
|
+
'max-len': [ 'error', 120 ],
|
|
48
|
+
'no-mixed-spaces-and-tabs': 'error',
|
|
49
|
+
'no-multiple-empty-lines': 'error',
|
|
50
|
+
'no-nested-ternary': 'error',
|
|
51
|
+
'no-trailing-spaces': 'error',
|
|
52
|
+
'object-curly-spacing': [ 'error', 'always' ],
|
|
53
|
+
'padded-blocks': [ 'error', 'never' ],
|
|
54
|
+
'padding-line-between-statements': [
|
|
55
|
+
'error',
|
|
56
|
+
{ blankLine: 'always', prev: [ 'const', 'let', 'var' ], next: '*' },
|
|
57
|
+
{ blankLine: 'any', prev: [ 'const', 'let', 'var' ], next: [ 'const', 'let', 'var' ] },
|
|
58
|
+
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
59
|
+
{ blankLine: 'always', prev: '*', next: 'block-like' },
|
|
60
|
+
{ blankLine: 'always', prev: 'block-like', next: '*' },
|
|
61
|
+
],
|
|
62
|
+
'quotes': [ 'error', 'single' ],
|
|
63
|
+
'semi': [ 'error', 'always' ],
|
|
64
|
+
'space-before-blocks': 'error',
|
|
65
|
+
'spaced-comment': 'error',
|
|
66
|
+
}
|
|
67
|
+
};
|
package/src/EventEmitter.ts
CHANGED
|
@@ -6,11 +6,12 @@ const EventEmitter = new NativeEventEmitter(WebRTCModule);
|
|
|
6
6
|
|
|
7
7
|
export default EventEmitter;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type EventHandler = (event: unknown) => void;
|
|
10
|
+
type Listener = unknown;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
const _subscriptions: Map<Listener, EmitterSubscription[]> = new Map();
|
|
12
13
|
|
|
13
|
-
export function addListener(listener:
|
|
14
|
+
export function addListener(listener: Listener, eventName: string, eventHandler: EventHandler): void {
|
|
14
15
|
if (!_subscriptions.has(listener)) {
|
|
15
16
|
_subscriptions.set(listener, []);
|
|
16
17
|
}
|
|
@@ -18,7 +19,7 @@ export function addListener(listener: any, eventName: string, eventHandler: Even
|
|
|
18
19
|
_subscriptions.get(listener)?.push(EventEmitter.addListener(eventName, eventHandler));
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export function removeListener(listener:
|
|
22
|
+
export function removeListener(listener: Listener): void {
|
|
22
23
|
_subscriptions.get(listener)?.forEach(sub => {
|
|
23
24
|
sub.remove();
|
|
24
25
|
});
|
package/src/Logger.ts
CHANGED
package/src/MediaDevices.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { NativeModules } from 'react-native';
|
|
3
2
|
import { defineCustomEventTarget } from 'event-target-shim';
|
|
3
|
+
import { NativeModules } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import getDisplayMedia from './getDisplayMedia';
|
|
6
6
|
import getUserMedia from './getUserMedia';
|
|
7
7
|
|
|
8
8
|
const { WebRTCModule } = NativeModules;
|
|
9
9
|
|
|
10
|
-
const MEDIA_DEVICES_EVENTS = ['devicechange'];
|
|
10
|
+
const MEDIA_DEVICES_EVENTS = [ 'devicechange' ];
|
|
11
11
|
|
|
12
12
|
class MediaDevices extends defineCustomEventTarget(...MEDIA_DEVICES_EVENTS) {
|
|
13
13
|
/**
|
package/src/MediaStream.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { NativeModules } from 'react-native';
|
|
3
2
|
import { defineCustomEventTarget } from 'event-target-shim';
|
|
4
|
-
import {
|
|
3
|
+
import { NativeModules } from 'react-native';
|
|
5
4
|
|
|
6
5
|
import MediaStreamTrack from './MediaStreamTrack';
|
|
6
|
+
import { uniqueID } from './RTCUtil';
|
|
7
7
|
|
|
8
8
|
const { WebRTCModule } = NativeModules;
|
|
9
9
|
|
|
10
|
-
const MEDIA_STREAM_EVENTS = ['active', 'inactive', 'addtrack', 'removetrack'];
|
|
10
|
+
const MEDIA_STREAM_EVENTS = [ 'active', 'inactive', 'addtrack', 'removetrack' ];
|
|
11
11
|
|
|
12
12
|
export default class MediaStream extends defineCustomEventTarget(...MEDIA_STREAM_EVENTS) {
|
|
13
13
|
id: string;
|
|
@@ -51,17 +51,20 @@ export default class MediaStream extends defineCustomEventTarget(...MEDIA_STREAM
|
|
|
51
51
|
WebRTCModule.mediaStreamCreate(this.id);
|
|
52
52
|
} else if (arg instanceof MediaStream) {
|
|
53
53
|
WebRTCModule.mediaStreamCreate(this.id);
|
|
54
|
+
|
|
54
55
|
for (const track of arg.getTracks()) {
|
|
55
56
|
this.addTrack(track);
|
|
56
57
|
}
|
|
57
58
|
} else if (Array.isArray(arg)) {
|
|
58
59
|
WebRTCModule.mediaStreamCreate(this.id);
|
|
60
|
+
|
|
59
61
|
for (const track of arg) {
|
|
60
62
|
this.addTrack(track);
|
|
61
63
|
}
|
|
62
64
|
} else if (typeof arg === 'object' && arg.streamId && arg.streamReactTag && arg.tracks) {
|
|
63
65
|
this.id = arg.streamId;
|
|
64
66
|
this._reactTag = arg.streamReactTag;
|
|
67
|
+
|
|
65
68
|
for (const trackInfo of arg.tracks) {
|
|
66
69
|
// We are not using addTrack here because the track is already part of the
|
|
67
70
|
// stream, so there is no need to add it on the native side.
|
|
@@ -74,18 +77,22 @@ export default class MediaStream extends defineCustomEventTarget(...MEDIA_STREAM
|
|
|
74
77
|
|
|
75
78
|
addTrack(track: MediaStreamTrack): void {
|
|
76
79
|
const index = this._tracks.indexOf(track);
|
|
80
|
+
|
|
77
81
|
if (index !== -1) {
|
|
78
82
|
return;
|
|
79
83
|
}
|
|
84
|
+
|
|
80
85
|
this._tracks.push(track);
|
|
81
86
|
WebRTCModule.mediaStreamAddTrack(this._reactTag, track.id);
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
removeTrack(track: MediaStreamTrack): void {
|
|
85
90
|
const index = this._tracks.indexOf(track);
|
|
91
|
+
|
|
86
92
|
if (index === -1) {
|
|
87
93
|
return;
|
|
88
94
|
}
|
|
95
|
+
|
|
89
96
|
this._tracks.splice(index, 1);
|
|
90
97
|
WebRTCModule.mediaStreamRemoveTrack(this._reactTag, track.id);
|
|
91
98
|
}
|
|
@@ -115,9 +122,11 @@ export default class MediaStream extends defineCustomEventTarget(...MEDIA_STREAM
|
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
release(releaseTracks = true): void {
|
|
118
|
-
const tracks = [...this._tracks];
|
|
125
|
+
const tracks = [ ...this._tracks ];
|
|
126
|
+
|
|
119
127
|
for (const track of tracks) {
|
|
120
128
|
this.removeTrack(track);
|
|
129
|
+
|
|
121
130
|
if (releaseTracks) {
|
|
122
131
|
track.release();
|
|
123
132
|
}
|
package/src/MediaStreamTrack.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
import { NativeModules } from 'react-native';
|
|
3
2
|
import { defineCustomEventTarget } from 'event-target-shim';
|
|
3
|
+
import { NativeModules } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { deepClone } from './RTCUtil';
|
|
6
6
|
|
|
7
7
|
const { WebRTCModule } = NativeModules;
|
|
8
8
|
|
|
9
|
-
const MEDIA_STREAM_TRACK_EVENTS = ['ended', 'mute', 'unmute'];
|
|
9
|
+
const MEDIA_STREAM_TRACK_EVENTS = [ 'ended', 'mute', 'unmute' ];
|
|
10
10
|
|
|
11
11
|
type MediaStreamTrackState = 'live' | 'ended';
|
|
12
12
|
|
|
@@ -19,10 +19,10 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
19
19
|
|
|
20
20
|
readonly id: string;
|
|
21
21
|
readonly kind: string;
|
|
22
|
-
readonly label: string =
|
|
22
|
+
readonly label: string = '';
|
|
23
23
|
readyState: MediaStreamTrackState;
|
|
24
24
|
readonly remote: boolean;
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
constructor(info) {
|
|
27
27
|
super();
|
|
28
28
|
|
|
@@ -37,6 +37,7 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
37
37
|
this.remote = info.remote;
|
|
38
38
|
|
|
39
39
|
const _readyState = info.readyState.toLowerCase();
|
|
40
|
+
|
|
40
41
|
this.readyState = _readyState === 'initializing' || _readyState === 'live' ? 'live' : 'ended';
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -48,6 +49,7 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
48
49
|
if (enabled === this._enabled) {
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
52
|
+
|
|
51
53
|
WebRTCModule.mediaStreamTrackSetEnabled(this.id, !this._enabled);
|
|
52
54
|
this._enabled = !this._enabled;
|
|
53
55
|
}
|
|
@@ -73,12 +75,26 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
73
75
|
if (this.remote) {
|
|
74
76
|
throw new Error('Not implemented for remote tracks');
|
|
75
77
|
}
|
|
78
|
+
|
|
76
79
|
if (this.kind !== 'video') {
|
|
77
80
|
throw new Error('Only implemented for video tracks');
|
|
78
81
|
}
|
|
82
|
+
|
|
79
83
|
WebRTCModule.mediaStreamTrackSwitchCamera(this.id);
|
|
80
84
|
}
|
|
81
85
|
|
|
86
|
+
_setVideoEffect(name:string) {
|
|
87
|
+
if (this.remote) {
|
|
88
|
+
throw new Error('Not implemented for remote tracks');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (this.kind !== 'video') {
|
|
92
|
+
throw new Error('Only implemented for video tracks');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
WebRTCModule.mediaStreamTrackSetVideoEffect(this.id, name);
|
|
96
|
+
}
|
|
97
|
+
|
|
82
98
|
applyConstraints(): never {
|
|
83
99
|
throw new Error('Not implemented.');
|
|
84
100
|
}
|
|
@@ -98,7 +114,7 @@ class MediaStreamTrack extends defineCustomEventTarget(...MEDIA_STREAM_TRACK_EVE
|
|
|
98
114
|
getSettings() {
|
|
99
115
|
return deepClone(this._settings);
|
|
100
116
|
}
|
|
101
|
-
|
|
117
|
+
|
|
102
118
|
release(): void {
|
|
103
119
|
WebRTCModule.mediaStreamTrackRelease(this.id);
|
|
104
120
|
}
|
package/src/Permissions.ts
CHANGED
|
@@ -29,9 +29,9 @@ class Permissions {
|
|
|
29
29
|
* This implementation only supports requesting these permissions, a subset
|
|
30
30
|
* of: https://www.w3.org/TR/permissions/#permission-registry
|
|
31
31
|
*/
|
|
32
|
-
VALID_PERMISSIONS = ['camera', 'microphone'];
|
|
32
|
+
VALID_PERMISSIONS = [ 'camera', 'microphone' ];
|
|
33
33
|
|
|
34
|
-
_lastReq: Promise<
|
|
34
|
+
_lastReq: Promise<unknown> = Promise.resolve();
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Helper for requesting Android permissions. On Android only one permission
|
|
@@ -44,7 +44,7 @@ class Permissions {
|
|
|
44
44
|
* https://facebook.github.io/react-native/docs/permissionsandroid#permissions-that-require-prompting-the-user
|
|
45
45
|
*/
|
|
46
46
|
_requestPermissionAndroid(perm: Permission) {
|
|
47
|
-
return new Promise(
|
|
47
|
+
return new Promise(resolve => {
|
|
48
48
|
PermissionsAndroid.request(perm).then(
|
|
49
49
|
granted => resolve(granted === PermissionsAndroid.RESULTS.GRANTED),
|
|
50
50
|
() => resolve(false)
|
|
@@ -59,12 +59,14 @@ class Permissions {
|
|
|
59
59
|
if (typeof permissionDesc !== 'object') {
|
|
60
60
|
throw new TypeError('Argument 1 of Permissions.query is not an object.');
|
|
61
61
|
}
|
|
62
|
+
|
|
62
63
|
if (typeof permissionDesc.name === 'undefined') {
|
|
63
|
-
throw new TypeError(
|
|
64
|
+
throw new TypeError('Missing required \'name\' member of PermissionDescriptor.');
|
|
64
65
|
}
|
|
66
|
+
|
|
65
67
|
if (this.VALID_PERMISSIONS.indexOf(permissionDesc.name) === -1) {
|
|
66
68
|
throw new TypeError(
|
|
67
|
-
|
|
69
|
+
'\'name\' member of PermissionDescriptor is not a valid value for enumeration PermissionName.'
|
|
68
70
|
);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
@@ -79,11 +81,13 @@ class Permissions {
|
|
|
79
81
|
} catch (e) {
|
|
80
82
|
return Promise.reject(e);
|
|
81
83
|
}
|
|
84
|
+
|
|
82
85
|
if (Platform.OS === 'android') {
|
|
83
86
|
const perm =
|
|
84
87
|
permissionDesc.name === 'camera'
|
|
85
88
|
? PermissionsAndroid.PERMISSIONS.CAMERA
|
|
86
89
|
: PermissionsAndroid.PERMISSIONS.RECORD_AUDIO;
|
|
90
|
+
|
|
87
91
|
return new Promise(resolve => {
|
|
88
92
|
PermissionsAndroid.check(perm).then(
|
|
89
93
|
granted => resolve(granted ? this.RESULT.GRANTED : this.RESULT.PROMPT),
|
|
@@ -107,13 +111,16 @@ class Permissions {
|
|
|
107
111
|
} catch (e) {
|
|
108
112
|
return Promise.reject(e);
|
|
109
113
|
}
|
|
114
|
+
|
|
110
115
|
if (Platform.OS === 'android') {
|
|
111
116
|
const perm =
|
|
112
117
|
permissionDesc.name === 'camera'
|
|
113
118
|
? PermissionsAndroid.PERMISSIONS.CAMERA
|
|
114
119
|
: PermissionsAndroid.PERMISSIONS.RECORD_AUDIO;
|
|
115
120
|
const requestPermission = () => this._requestPermissionAndroid(perm);
|
|
121
|
+
|
|
116
122
|
this._lastReq = this._lastReq.then(requestPermission, requestPermission);
|
|
123
|
+
|
|
117
124
|
return this._lastReq;
|
|
118
125
|
} else if (Platform.OS === 'ios' || Platform.OS === 'macos') {
|
|
119
126
|
return WebRTCModule.requestPermission(permissionDesc.name);
|