react-native-webrtc 106.0.0-beta.2 → 106.0.0-beta.4
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/SerializeUtils.java +65 -26
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +30 -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/SerializeUtils.m +18 -5
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +53 -5
- package/ios/RCTWebRTC/WebRTCModule+Transceivers.m +5 -4
- 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 +139 -58
- package/lib/commonjs/RTCPeerConnection.js.map +1 -1
- package/lib/commonjs/RTCRtcpParameters.js +7 -0
- 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 +22 -4
- package/lib/commonjs/RTCRtpCodecParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpEncodingParameters.js +21 -10
- package/lib/commonjs/RTCRtpEncodingParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpHeaderExtension.js +8 -0
- package/lib/commonjs/RTCRtpHeaderExtension.js.map +1 -1
- package/lib/commonjs/RTCRtpParameters.js +25 -3
- package/lib/commonjs/RTCRtpParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpReceiveParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpReceiver.js +21 -10
- package/lib/commonjs/RTCRtpReceiver.js.map +1 -1
- package/lib/commonjs/RTCRtpSendParameters.js +10 -4
- package/lib/commonjs/RTCRtpSendParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpSender.js +3 -3
- 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 +12 -93
- 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 +135 -55
- package/lib/module/RTCPeerConnection.js.map +1 -1
- package/lib/module/RTCRtcpParameters.js +7 -0
- 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 +22 -4
- package/lib/module/RTCRtpCodecParameters.js.map +1 -1
- package/lib/module/RTCRtpEncodingParameters.js +21 -10
- package/lib/module/RTCRtpEncodingParameters.js.map +1 -1
- package/lib/module/RTCRtpHeaderExtension.js +8 -0
- package/lib/module/RTCRtpHeaderExtension.js.map +1 -1
- package/lib/module/RTCRtpParameters.js +20 -3
- 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 +18 -8
- package/lib/module/RTCRtpReceiver.js.map +1 -1
- package/lib/module/RTCRtpSendParameters.js +10 -5
- package/lib/module/RTCRtpSendParameters.js.map +1 -1
- package/lib/module/RTCRtpSender.js +3 -3
- 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 +8 -26
- 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 +7 -8
- package/lib/typescript/RTCRtcpParameters.d.ts +6 -4
- package/lib/typescript/RTCRtpCodecParameters.d.ts +11 -9
- package/lib/typescript/RTCRtpEncodingParameters.d.ts +13 -11
- package/lib/typescript/RTCRtpHeaderExtension.d.ts +7 -5
- package/lib/typescript/RTCRtpParameters.d.ts +9 -8
- package/lib/typescript/RTCRtpReceiveParameters.d.ts +1 -1
- package/lib/typescript/RTCRtpReceiver.d.ts +9 -4
- package/lib/typescript/RTCRtpSendParameters.d.ts +9 -10
- package/lib/typescript/RTCRtpSender.d.ts +3 -3
- 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 +6 -15
- 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 +189 -91
- package/src/RTCRtcpParameters.ts +21 -12
- package/src/RTCRtpCapabilities.ts +15 -4
- package/src/RTCRtpCodecParameters.ts +34 -13
- package/src/RTCRtpEncodingParameters.ts +37 -23
- package/src/RTCRtpHeaderExtension.ts +15 -6
- package/src/RTCRtpParameters.ts +26 -11
- package/src/RTCRtpReceiveParameters.ts +3 -3
- package/src/RTCRtpReceiver.ts +26 -10
- package/src/RTCRtpSendParameters.ts +29 -17
- package/src/RTCRtpSender.ts +14 -13
- 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 +9 -34
- 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/lib/module/index.js
CHANGED
|
@@ -1,29 +1,20 @@
|
|
|
1
|
+
import Logger from './Logger';
|
|
2
|
+
import mediaDevices from './MediaDevices';
|
|
3
|
+
import MediaStream from './MediaStream';
|
|
4
|
+
import MediaStreamTrack from './MediaStreamTrack';
|
|
5
|
+
import permissions from './Permissions';
|
|
6
|
+
import RTCErrorEvent from './RTCErrorEvent';
|
|
1
7
|
import RTCIceCandidate from './RTCIceCandidate';
|
|
2
8
|
import RTCPeerConnection from './RTCPeerConnection';
|
|
3
9
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
4
10
|
import RTCRtpSender from './RTCRtpSender';
|
|
5
11
|
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
6
|
-
import RTCRtpCapabilities from './RTCRtpCapabilities';
|
|
7
|
-
import RTCRtpCodecCapability from './RTCRtpCodecCapability';
|
|
8
|
-
import RTCRtpEncodingParameters from './RTCRtpEncodingParameters';
|
|
9
|
-
import RTCRtpCodecParameters from './RTCRtpCodecParameters';
|
|
10
|
-
import RTCRtpParameters from './RTCRtpParameters';
|
|
11
|
-
import RTCRtcpParameters from './RTCRtcpParameters';
|
|
12
|
-
import RTCRtpHeaderExtension from './RTCRtpHeaderExtension';
|
|
13
|
-
import RTCRtpSendParameters from './RTCRtpSendParameters';
|
|
14
|
-
import RTCRtpReceiveParameters from './RTCRtpReceiveParameters';
|
|
15
12
|
import RTCSessionDescription from './RTCSessionDescription';
|
|
16
|
-
import RTCErrorEvent from './RTCErrorEvent';
|
|
17
13
|
import RTCView from './RTCView';
|
|
18
14
|
import ScreenCapturePickerView from './ScreenCapturePickerView';
|
|
19
|
-
|
|
20
|
-
import MediaStreamTrack from './MediaStreamTrack';
|
|
21
|
-
import mediaDevices from './MediaDevices';
|
|
22
|
-
import permissions from './Permissions';
|
|
23
|
-
import Logger from './Logger';
|
|
24
|
-
Logger.enable('*'); //Logger.enable(`*,-${Logger.ROOT_PREFIX}:*:DEBUG`);
|
|
15
|
+
Logger.enable('*'); // Logger.enable(`*,-${Logger.ROOT_PREFIX}:*:DEBUG`);
|
|
25
16
|
|
|
26
|
-
export { RTCIceCandidate, RTCPeerConnection, RTCSessionDescription, RTCView, ScreenCapturePickerView, RTCRtpTransceiver, RTCRtpReceiver, RTCRtpSender, RTCErrorEvent,
|
|
17
|
+
export { RTCIceCandidate, RTCPeerConnection, RTCSessionDescription, RTCView, ScreenCapturePickerView, RTCRtpTransceiver, RTCRtpReceiver, RTCRtpSender, RTCErrorEvent, MediaStream, MediaStreamTrack, mediaDevices, permissions, registerGlobals };
|
|
27
18
|
|
|
28
19
|
function registerGlobals() {
|
|
29
20
|
// Should not happen. React Native has a global navigator object.
|
|
@@ -49,14 +40,5 @@ function registerGlobals() {
|
|
|
49
40
|
global.RTCRtpReceiver = RTCRtpReceiver;
|
|
50
41
|
global.RTCRtpSender = RTCRtpSender;
|
|
51
42
|
global.RTCErrorEvent = RTCErrorEvent;
|
|
52
|
-
global.RTCRtpCapabilities = RTCRtpCapabilities;
|
|
53
|
-
global.RTCRtpCodecCapability = RTCRtpCodecCapability;
|
|
54
|
-
global.RTCRtpCodecParameters = RTCRtpCodecParameters;
|
|
55
|
-
global.RTCRtpEncodingParameters = RTCRtpEncodingParameters;
|
|
56
|
-
global.RTCRtpParameters = RTCRtpParameters;
|
|
57
|
-
global.RTCRtpSendParameters = RTCRtpSendParameters;
|
|
58
|
-
global.RTCRtpReceiverParameters = RTCRtpReceiveParameters;
|
|
59
|
-
global.RTCRtcpParameters = RTCRtcpParameters;
|
|
60
|
-
global.RTCRtpHeaderExtension = RTCRtpHeaderExtension;
|
|
61
43
|
}
|
|
62
44
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["Logger","mediaDevices","MediaStream","MediaStreamTrack","permissions","RTCErrorEvent","RTCIceCandidate","RTCPeerConnection","RTCRtpReceiver","RTCRtpSender","RTCRtpTransceiver","RTCSessionDescription","RTCView","ScreenCapturePickerView","enable","registerGlobals","global","navigator","Error","getUserMedia","bind","getDisplayMedia","enumerateDevices"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,UAAnB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,OAAOC,qBAAP,MAAkC,yBAAlC;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAOC,uBAAP,MAAoC,2BAApC;AAEAb,MAAM,CAACc,MAAP,CAAc,GAAd,E,CACA;;AAEA,SACIR,eADJ,EAEIC,iBAFJ,EAGII,qBAHJ,EAIIC,OAJJ,EAKIC,uBALJ,EAMIH,iBANJ,EAOIF,cAPJ,EAQIC,YARJ,EASIJ,aATJ,EAUIH,WAVJ,EAWIC,gBAXJ,EAYIF,YAZJ,EAaIG,WAbJ,EAcIW,eAdJ;;AAmBA,SAASA,eAAT,GAAiC;AAC7B;AACA,MAAI,OAAOC,MAAM,CAACC,SAAd,KAA4B,QAAhC,EAA0C;AACtC,UAAM,IAAIC,KAAJ,CAAU,4BAAV,CAAN;AACH;;AAED,MAAI,CAACF,MAAM,CAACC,SAAP,CAAiBhB,YAAtB,EAAoC;AAChCe,IAAAA,MAAM,CAACC,SAAP,CAAiBhB,YAAjB,GAAgC,EAAhC;AACH;;AAEDe,EAAAA,MAAM,CAACC,SAAP,CAAiBhB,YAAjB,CAA8BkB,YAA9B,GAA6ClB,YAAY,CAACkB,YAAb,CAA0BC,IAA1B,CAA+BnB,YAA/B,CAA7C;AACAe,EAAAA,MAAM,CAACC,SAAP,CAAiBhB,YAAjB,CAA8BoB,eAA9B,GAAgDpB,YAAY,CAACoB,eAAb,CAA6BD,IAA7B,CAAkCnB,YAAlC,CAAhD;AACAe,EAAAA,MAAM,CAACC,SAAP,CAAiBhB,YAAjB,CAA8BqB,gBAA9B,GAAiDrB,YAAY,CAACqB,gBAAb,CAA8BF,IAA9B,CAAmCnB,YAAnC,CAAjD;AAEAe,EAAAA,MAAM,CAACV,eAAP,GAAyBA,eAAzB;AACAU,EAAAA,MAAM,CAACT,iBAAP,GAA2BA,iBAA3B;AACAS,EAAAA,MAAM,CAACR,cAAP,GAAwBA,cAAxB;AACAQ,EAAAA,MAAM,CAACP,YAAP,GAAsBD,cAAtB;AACAQ,EAAAA,MAAM,CAACL,qBAAP,GAA+BA,qBAA/B;AACAK,EAAAA,MAAM,CAACd,WAAP,GAAqBA,WAArB;AACAc,EAAAA,MAAM,CAACb,gBAAP,GAA0BA,gBAA1B;AACAa,EAAAA,MAAM,CAACN,iBAAP,GAA2BA,iBAA3B;AACAM,EAAAA,MAAM,CAACR,cAAP,GAAwBA,cAAxB;AACAQ,EAAAA,MAAM,CAACP,YAAP,GAAsBA,YAAtB;AACAO,EAAAA,MAAM,CAACX,aAAP,GAAuBA,aAAvB;AACH","sourcesContent":["import Logger from './Logger';\nimport mediaDevices from './MediaDevices';\nimport MediaStream from './MediaStream';\nimport MediaStreamTrack from './MediaStreamTrack';\nimport permissions from './Permissions';\nimport RTCErrorEvent from './RTCErrorEvent';\nimport RTCIceCandidate from './RTCIceCandidate';\nimport RTCPeerConnection from './RTCPeerConnection';\nimport RTCRtpReceiver from './RTCRtpReceiver';\nimport RTCRtpSender from './RTCRtpSender';\nimport RTCRtpTransceiver from './RTCRtpTransceiver';\nimport RTCSessionDescription from './RTCSessionDescription';\nimport RTCView from './RTCView';\nimport ScreenCapturePickerView from './ScreenCapturePickerView';\n\nLogger.enable('*');\n// Logger.enable(`*,-${Logger.ROOT_PREFIX}:*:DEBUG`);\n\nexport {\n RTCIceCandidate,\n RTCPeerConnection,\n RTCSessionDescription,\n RTCView,\n ScreenCapturePickerView,\n RTCRtpTransceiver,\n RTCRtpReceiver,\n RTCRtpSender,\n RTCErrorEvent,\n MediaStream,\n MediaStreamTrack,\n mediaDevices,\n permissions,\n registerGlobals\n};\n\ndeclare const global: any;\n\nfunction registerGlobals(): void {\n // Should not happen. React Native has a global navigator object.\n if (typeof global.navigator !== 'object') {\n throw new Error('navigator is not an object');\n }\n\n if (!global.navigator.mediaDevices) {\n global.navigator.mediaDevices = {};\n }\n\n global.navigator.mediaDevices.getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);\n global.navigator.mediaDevices.getDisplayMedia = mediaDevices.getDisplayMedia.bind(mediaDevices);\n global.navigator.mediaDevices.enumerateDevices = mediaDevices.enumerateDevices.bind(mediaDevices);\n\n global.RTCIceCandidate = RTCIceCandidate;\n global.RTCPeerConnection = RTCPeerConnection;\n global.RTCRtpReceiver = RTCRtpReceiver;\n global.RTCRtpSender = RTCRtpReceiver;\n global.RTCSessionDescription = RTCSessionDescription;\n global.MediaStream = MediaStream;\n global.MediaStreamTrack = MediaStreamTrack;\n global.RTCRtpTransceiver = RTCRtpTransceiver;\n global.RTCRtpReceiver = RTCRtpReceiver;\n global.RTCRtpSender = RTCRtpSender;\n global.RTCErrorEvent = RTCErrorEvent;\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeEventEmitter } from 'react-native';
|
|
2
2
|
declare const EventEmitter: NativeEventEmitter;
|
|
3
3
|
export default EventEmitter;
|
|
4
|
-
declare type EventHandler = (event:
|
|
5
|
-
|
|
6
|
-
export declare function
|
|
4
|
+
declare type EventHandler = (event: unknown) => void;
|
|
5
|
+
declare type Listener = unknown;
|
|
6
|
+
export declare function addListener(listener: Listener, eventName: string, eventHandler: EventHandler): void;
|
|
7
|
+
export declare function removeListener(listener: Listener): void;
|
|
@@ -24,7 +24,7 @@ declare class Permissions {
|
|
|
24
24
|
* of: https://www.w3.org/TR/permissions/#permission-registry
|
|
25
25
|
*/
|
|
26
26
|
VALID_PERMISSIONS: string[];
|
|
27
|
-
_lastReq: Promise<
|
|
27
|
+
_lastReq: Promise<unknown>;
|
|
28
28
|
/**
|
|
29
29
|
* Helper for requesting Android permissions. On Android only one permission
|
|
30
30
|
* can be requested at a time (unless the multi-permission API is used,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineCustomEventTarget } from 'event-target-shim';
|
|
2
|
+
import { EmitterSubscription } from 'react-native';
|
|
2
3
|
declare type RTCDataChannelState = 'connecting' | 'open' | 'closing' | 'closed';
|
|
3
4
|
declare const RTCDataChannel_base: defineCustomEventTarget.CustomEventTargetConstructor<Record<string, import("event-target-shim").Event<string>>, "standard">;
|
|
4
5
|
export default class RTCDataChannel extends RTCDataChannel_base {
|
|
@@ -12,7 +13,7 @@ export default class RTCDataChannel extends RTCDataChannel_base {
|
|
|
12
13
|
_ordered: boolean;
|
|
13
14
|
_protocol: string;
|
|
14
15
|
_readyState: RTCDataChannelState;
|
|
15
|
-
_subscriptions:
|
|
16
|
+
_subscriptions: EmitterSubscription[];
|
|
16
17
|
binaryType: string;
|
|
17
18
|
bufferedAmount: number;
|
|
18
19
|
bufferedAmountLowThreshold: number;
|
|
@@ -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},
|
|
@@ -76,7 +75,7 @@ export default class RTCPeerConnection extends RTCPeerConnection_base {
|
|
|
76
75
|
*/
|
|
77
76
|
_trackExists(track: MediaStreamTrack): boolean;
|
|
78
77
|
/**
|
|
79
|
-
*
|
|
78
|
+
* Updates transceivers after offer/answer updates if necessary.
|
|
80
79
|
*/
|
|
81
80
|
_updateTransceivers(transceiverUpdates: any): void;
|
|
82
81
|
/**
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export interface RTCRtcpParametersInit {
|
|
2
|
+
cname: string;
|
|
3
|
+
reducedSize: boolean;
|
|
4
|
+
}
|
|
1
5
|
export default class RTCRtcpParameters {
|
|
2
6
|
readonly cname: string;
|
|
3
7
|
readonly reducedSize: boolean;
|
|
4
|
-
constructor(init:
|
|
5
|
-
|
|
6
|
-
reducedSize: boolean;
|
|
7
|
-
});
|
|
8
|
+
constructor(init: RTCRtcpParametersInit);
|
|
9
|
+
toJSON(): RTCRtcpParametersInit;
|
|
8
10
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
export interface RTCRtpCodecParametersInit {
|
|
2
|
+
payloadType: number;
|
|
3
|
+
clockRate: number;
|
|
4
|
+
mimeType: string;
|
|
5
|
+
channels?: number;
|
|
6
|
+
sdpFmtpLine?: string;
|
|
7
|
+
}
|
|
1
8
|
export default class RTCRtpCodecParameters {
|
|
2
9
|
readonly payloadType: number;
|
|
3
10
|
readonly clockRate: number;
|
|
4
|
-
readonly channels: number;
|
|
5
11
|
readonly mimeType: string;
|
|
6
|
-
readonly
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
channels: number;
|
|
11
|
-
mimeType: string;
|
|
12
|
-
sdpFmtpLine: Map<String, String>;
|
|
13
|
-
});
|
|
12
|
+
readonly channels: number | null;
|
|
13
|
+
readonly sdpFmtpLine: string | null;
|
|
14
|
+
constructor(init: RTCRtpCodecParametersInit);
|
|
15
|
+
toJSON(): RTCRtpCodecParametersInit;
|
|
14
16
|
}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
export interface RTCRtpEncodingParametersInit {
|
|
2
|
+
active: boolean;
|
|
3
|
+
rid?: string;
|
|
4
|
+
maxFramerate?: number;
|
|
5
|
+
maxBitrate?: number;
|
|
6
|
+
scaleResolutionDownBy?: number;
|
|
7
|
+
}
|
|
1
8
|
export default class RTCRtpEncodingParameters {
|
|
2
9
|
readonly active: boolean;
|
|
10
|
+
_rid: string | null;
|
|
3
11
|
_maxFramerate: number | null;
|
|
4
12
|
_maxBitrate: number | null;
|
|
5
13
|
_scaleResolutionDownBy: number | null;
|
|
6
|
-
constructor(init:
|
|
7
|
-
|
|
8
|
-
maxFramerate?: number;
|
|
9
|
-
maxBitrate?: number;
|
|
10
|
-
scaleResolutionDownBy?: number;
|
|
11
|
-
});
|
|
14
|
+
constructor(init: RTCRtpEncodingParametersInit);
|
|
15
|
+
get rid(): string | null;
|
|
12
16
|
get maxFramerate(): number | null;
|
|
13
|
-
get maxBitrate(): number | null;
|
|
14
|
-
get scaleResolutionDownBy(): number | null;
|
|
15
17
|
set maxFramerate(framerate: number | null);
|
|
18
|
+
get maxBitrate(): number | null;
|
|
16
19
|
set maxBitrate(bitrate: number | null);
|
|
20
|
+
get scaleResolutionDownBy(): number | null;
|
|
17
21
|
set scaleResolutionDownBy(resolutionScale: number | null);
|
|
18
|
-
toJSON():
|
|
19
|
-
active: boolean;
|
|
20
|
-
};
|
|
22
|
+
toJSON(): RTCRtpEncodingParametersInit;
|
|
21
23
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
export interface RTCRtpHeaderExtensionInit {
|
|
2
|
+
id: number;
|
|
3
|
+
uri: string;
|
|
4
|
+
encrypted: boolean;
|
|
5
|
+
}
|
|
1
6
|
export default class RTCRtpHeaderExtension {
|
|
2
7
|
readonly id: number;
|
|
3
8
|
readonly uri: string;
|
|
4
9
|
readonly encrypted: boolean;
|
|
5
|
-
constructor(init:
|
|
6
|
-
|
|
7
|
-
uri: string;
|
|
8
|
-
encrypted: boolean;
|
|
9
|
-
});
|
|
10
|
+
constructor(init: RTCRtpHeaderExtensionInit);
|
|
11
|
+
toJSON(): RTCRtpHeaderExtensionInit;
|
|
10
12
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import RTCRtcpParameters from
|
|
2
|
-
import RTCRtpCodecParameters from
|
|
3
|
-
import RTCRtpHeaderExtension from
|
|
4
|
-
export
|
|
5
|
-
codecs:
|
|
6
|
-
headerExtensions:
|
|
7
|
-
rtcp:
|
|
8
|
-
}
|
|
1
|
+
import RTCRtcpParameters, { RTCRtcpParametersInit } from './RTCRtcpParameters';
|
|
2
|
+
import RTCRtpCodecParameters, { RTCRtpCodecParametersInit } from './RTCRtpCodecParameters';
|
|
3
|
+
import RTCRtpHeaderExtension, { RTCRtpHeaderExtensionInit } from './RTCRtpHeaderExtension';
|
|
4
|
+
export interface RTCRtpParametersInit {
|
|
5
|
+
codecs: RTCRtpCodecParametersInit[];
|
|
6
|
+
headerExtensions: RTCRtpHeaderExtensionInit[];
|
|
7
|
+
rtcp: RTCRtcpParametersInit;
|
|
8
|
+
}
|
|
9
9
|
export default class RTCRtpParameters {
|
|
10
10
|
readonly codecs: RTCRtpCodecParameters[];
|
|
11
11
|
readonly headerExtensions: RTCRtpHeaderExtension[];
|
|
12
12
|
readonly rtcp: RTCRtcpParameters;
|
|
13
13
|
constructor(init: RTCRtpParametersInit);
|
|
14
|
+
toJSON(): RTCRtpParametersInit;
|
|
14
15
|
}
|
|
@@ -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
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import MediaStreamTrack from './MediaStreamTrack';
|
|
2
2
|
import RTCRtpCapabilities from './RTCRtpCapabilities';
|
|
3
|
+
import { RTCRtpParametersInit } from './RTCRtpParameters';
|
|
4
|
+
import RTCRtpReceiveParameters from './RTCRtpReceiveParameters';
|
|
3
5
|
export default class RTCRtpReceiver {
|
|
4
6
|
_id: string;
|
|
5
7
|
_peerConnectionId: number;
|
|
6
|
-
_track: MediaStreamTrack;
|
|
8
|
+
_track: MediaStreamTrack | null;
|
|
9
|
+
_rtpParameters: RTCRtpReceiveParameters;
|
|
7
10
|
constructor(info: {
|
|
8
11
|
peerConnectionId: number;
|
|
9
12
|
id: string;
|
|
10
|
-
track
|
|
13
|
+
track?: MediaStreamTrack;
|
|
14
|
+
rtpParameters: RTCRtpParametersInit;
|
|
11
15
|
});
|
|
12
|
-
static getCapabilities(kind:
|
|
16
|
+
static getCapabilities(kind: 'audio' | 'video'): RTCRtpCapabilities;
|
|
17
|
+
getParameters(): RTCRtpReceiveParameters;
|
|
13
18
|
get id(): string;
|
|
14
|
-
get track(): MediaStreamTrack;
|
|
19
|
+
get track(): MediaStreamTrack | null;
|
|
15
20
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import RTCRtpEncodingParameters, { RTCRtpEncodingParametersInit } from './RTCRtpEncodingParameters';
|
|
2
|
+
import RTCRtpParameters, { RTCRtpParametersInit } from './RTCRtpParameters';
|
|
3
3
|
declare type DegradationPreferenceType = 'maintain-framerate' | 'maintain-resolution' | 'balanced' | 'disabled';
|
|
4
|
+
export interface RTCRtpSendParametersInit extends RTCRtpParametersInit {
|
|
5
|
+
transactionId: string;
|
|
6
|
+
encodings: RTCRtpEncodingParametersInit[];
|
|
7
|
+
degradationPreference?: string;
|
|
8
|
+
}
|
|
4
9
|
export default class RTCRtpSendParameters extends RTCRtpParameters {
|
|
5
10
|
readonly transactionId: string;
|
|
6
11
|
readonly encodings: RTCRtpEncodingParameters[];
|
|
7
12
|
degradationPreference: DegradationPreferenceType | null;
|
|
8
|
-
constructor(init:
|
|
9
|
-
|
|
10
|
-
encodings: RTCRtpEncodingParameters[];
|
|
11
|
-
degradationPreference?: string;
|
|
12
|
-
});
|
|
13
|
-
toJSON(): {
|
|
14
|
-
encodings: RTCRtpEncodingParameters[];
|
|
15
|
-
};
|
|
13
|
+
constructor(init: RTCRtpSendParametersInit);
|
|
14
|
+
toJSON(): RTCRtpSendParametersInit;
|
|
16
15
|
}
|
|
17
16
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MediaStreamTrack from './MediaStreamTrack';
|
|
2
2
|
import RTCRtpCapabilities from './RTCRtpCapabilities';
|
|
3
|
-
import RTCRtpSendParameters from './RTCRtpSendParameters';
|
|
3
|
+
import RTCRtpSendParameters, { RTCRtpSendParametersInit } from './RTCRtpSendParameters';
|
|
4
4
|
export default class RTCRtpSender {
|
|
5
5
|
_id: string;
|
|
6
6
|
_track: MediaStreamTrack | null;
|
|
@@ -10,10 +10,10 @@ export default class RTCRtpSender {
|
|
|
10
10
|
peerConnectionId: number;
|
|
11
11
|
id: string;
|
|
12
12
|
track?: MediaStreamTrack;
|
|
13
|
-
rtpParameters:
|
|
13
|
+
rtpParameters: RTCRtpSendParametersInit;
|
|
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,15 @@
|
|
|
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
8
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
4
9
|
import RTCRtpSender from './RTCRtpSender';
|
|
5
10
|
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
6
|
-
import RTCRtpCapabilities from './RTCRtpCapabilities';
|
|
7
|
-
import RTCRtpCodecCapability from './RTCRtpCodecCapability';
|
|
8
|
-
import RTCRtpEncodingParameters from './RTCRtpEncodingParameters';
|
|
9
|
-
import RTCRtpCodecParameters from './RTCRtpCodecParameters';
|
|
10
|
-
import RTCRtpParameters from './RTCRtpParameters';
|
|
11
|
-
import RTCRtcpParameters from './RTCRtcpParameters';
|
|
12
|
-
import RTCRtpHeaderExtension from './RTCRtpHeaderExtension';
|
|
13
|
-
import RTCRtpSendParameters from './RTCRtpSendParameters';
|
|
14
|
-
import RTCRtpReceiveParameters from './RTCRtpReceiveParameters';
|
|
15
11
|
import RTCSessionDescription from './RTCSessionDescription';
|
|
16
|
-
import RTCErrorEvent from './RTCErrorEvent';
|
|
17
12
|
import RTCView from './RTCView';
|
|
18
13
|
import ScreenCapturePickerView from './ScreenCapturePickerView';
|
|
19
|
-
|
|
20
|
-
import MediaStreamTrack from './MediaStreamTrack';
|
|
21
|
-
import mediaDevices from './MediaDevices';
|
|
22
|
-
import permissions from './Permissions';
|
|
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 };
|
|
14
|
+
export { RTCIceCandidate, RTCPeerConnection, RTCSessionDescription, RTCView, ScreenCapturePickerView, RTCRtpTransceiver, RTCRtpReceiver, RTCRtpSender, RTCErrorEvent, MediaStream, MediaStreamTrack, mediaDevices, permissions, registerGlobals };
|
|
24
15
|
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.4",
|
|
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/android-webrtc.zip"
|
|
64
|
-
"ios": "https://github.com/jitsi/webrtc/releases/download/v106.0.0/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
|
});
|