react-native-webrtc 111.0.3 → 111.0.5
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/README.md +13 -10
- package/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +1 -1
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +16 -2
- package/ios/RCTWebRTC/CaptureController.m +4 -0
- package/ios/RCTWebRTC/ScreenCaptureController.m +4 -0
- package/ios/RCTWebRTC/ScreenCapturePickerViewManager.m +2 -2
- package/ios/RCTWebRTC/ScreenCapturer.m +4 -0
- package/ios/RCTWebRTC/TrackCapturerEventsEmitter.m +1 -1
- package/ios/RCTWebRTC/VideoCaptureController.h +2 -1
- package/ios/RCTWebRTC/VideoCaptureController.m +3 -0
- package/ios/RCTWebRTC/WebRTCModule+Permissions.m +10 -1
- package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.h +1 -1
- package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +40 -3
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +10 -4
- package/ios/RCTWebRTC/WebRTCModule.m +3 -1
- package/ios/RCTWebRTC/WebRTCModuleOptions.h +1 -0
- package/ios/RCTWebRTC/WebRTCModuleOptions.m +1 -0
- package/ios/RCTWebRTC.xcodeproj/project.pbxproj +1 -0
- package/lib/commonjs/MediaStream.js +2 -3
- package/lib/commonjs/MediaStream.js.map +1 -1
- package/lib/commonjs/MediaStreamTrackEvent.js +12 -2
- package/lib/commonjs/MediaStreamTrackEvent.js.map +1 -1
- package/lib/commonjs/MessageEvent.js +13 -2
- package/lib/commonjs/MessageEvent.js.map +1 -1
- package/lib/commonjs/RTCDataChannel.js +1 -8
- package/lib/commonjs/RTCDataChannel.js.map +1 -1
- package/lib/commonjs/RTCDataChannelEvent.js +12 -2
- package/lib/commonjs/RTCDataChannelEvent.js.map +1 -1
- package/lib/commonjs/RTCErrorEvent.js +2 -3
- package/lib/commonjs/RTCErrorEvent.js.map +1 -1
- package/lib/commonjs/RTCEvent.js +13 -3
- package/lib/commonjs/RTCEvent.js.map +1 -1
- package/lib/commonjs/RTCIceCandidate.js.map +1 -1
- package/lib/commonjs/RTCIceCandidateEvent.js +13 -2
- package/lib/commonjs/RTCIceCandidateEvent.js.map +1 -1
- package/lib/commonjs/RTCPeerConnection.js +4 -23
- package/lib/commonjs/RTCPeerConnection.js.map +1 -1
- package/lib/commonjs/RTCTrackEvent.js +18 -2
- package/lib/commonjs/RTCTrackEvent.js.map +1 -1
- package/lib/module/MediaStream.js +2 -3
- package/lib/module/MediaStream.js.map +1 -1
- package/lib/module/MediaStreamTrackEvent.js +12 -2
- package/lib/module/MediaStreamTrackEvent.js.map +1 -1
- package/lib/module/MessageEvent.js +13 -2
- package/lib/module/MessageEvent.js.map +1 -1
- package/lib/module/RTCDataChannel.js +2 -9
- package/lib/module/RTCDataChannel.js.map +1 -1
- package/lib/module/RTCDataChannelEvent.js +12 -2
- package/lib/module/RTCDataChannelEvent.js.map +1 -1
- package/lib/module/RTCErrorEvent.js +2 -2
- package/lib/module/RTCErrorEvent.js.map +1 -1
- package/lib/module/RTCEvent.js +14 -3
- package/lib/module/RTCEvent.js.map +1 -1
- package/lib/module/RTCIceCandidate.js.map +1 -1
- package/lib/module/RTCIceCandidateEvent.js +13 -2
- package/lib/module/RTCIceCandidateEvent.js.map +1 -1
- package/lib/module/RTCPeerConnection.js +5 -24
- package/lib/module/RTCPeerConnection.js.map +1 -1
- package/lib/module/RTCTrackEvent.js +18 -2
- package/lib/module/RTCTrackEvent.js.map +1 -1
- package/lib/typescript/MediaStream.d.ts +14 -4
- package/lib/typescript/MediaStream.d.ts.map +1 -1
- package/lib/typescript/MediaStreamTrackEvent.d.ts +16 -5
- package/lib/typescript/MediaStreamTrackEvent.d.ts.map +1 -1
- package/lib/typescript/MessageEvent.d.ts +17 -5
- package/lib/typescript/MessageEvent.d.ts.map +1 -1
- package/lib/typescript/RTCDataChannel.d.ts +12 -3
- package/lib/typescript/RTCDataChannel.d.ts.map +1 -1
- package/lib/typescript/RTCDataChannelEvent.d.ts +16 -5
- package/lib/typescript/RTCDataChannelEvent.d.ts.map +1 -1
- package/lib/typescript/RTCErrorEvent.d.ts +3 -3
- package/lib/typescript/RTCErrorEvent.d.ts.map +1 -1
- package/lib/typescript/RTCEvent.d.ts +12 -3
- package/lib/typescript/RTCEvent.d.ts.map +1 -1
- package/lib/typescript/RTCIceCandidate.d.ts +7 -5
- package/lib/typescript/RTCIceCandidate.d.ts.map +1 -1
- package/lib/typescript/RTCIceCandidateEvent.d.ts +17 -3
- package/lib/typescript/RTCIceCandidateEvent.d.ts.map +1 -1
- package/lib/typescript/RTCPeerConnection.d.ts +18 -3
- package/lib/typescript/RTCPeerConnection.d.ts.map +1 -1
- package/lib/typescript/RTCTrackEvent.d.ts +20 -6
- package/lib/typescript/RTCTrackEvent.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-webrtc.podspec +1 -1
- package/src/MediaStream.ts +14 -4
- package/src/MediaStreamTrackEvent.ts +18 -4
- package/src/MessageEvent.ts +19 -5
- package/src/RTCDataChannel.ts +10 -8
- package/src/RTCDataChannelEvent.ts +21 -4
- package/src/RTCErrorEvent.ts +3 -3
- package/src/RTCEvent.ts +18 -4
- package/src/RTCIceCandidate.ts +7 -1
- package/src/RTCIceCandidateEvent.ts +19 -4
- package/src/RTCPeerConnection.ts +20 -27
- package/src/RTCTrackEvent.ts +25 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTCIceCandidate.d.ts","sourceRoot":"","sources":["../../src/RTCIceCandidate.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,eAAe;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;gBAEH,EAAE,SAAc,EAAE,aAAoB,EAAE,MAAa,EAAE
|
|
1
|
+
{"version":3,"file":"RTCIceCandidate.d.ts","sourceRoot":"","sources":["../../src/RTCIceCandidate.ts"],"names":[],"mappings":"AAAA,UAAU,mBAAmB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,CAAC,OAAO,OAAO,eAAe;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;gBAEH,EAAE,SAAc,EAAE,aAAoB,EAAE,MAAa,EAAE,EAAE,mBAAmB;IAUxF,MAAM;;;;;CAOT"}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import { Event } from 'event-target-shim';
|
|
1
2
|
import type RTCIceCandidate from './RTCIceCandidate';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
type RTC_ICECANDIDATE_EVENTS = 'icecandidate' | 'icecandidateerror';
|
|
4
|
+
interface IRTCDataChannelEventInitDict extends Event.EventInit {
|
|
4
5
|
candidate: RTCIceCandidate | null;
|
|
5
|
-
constructor(type: any, eventInitDict: any);
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* @eventClass
|
|
9
|
+
* This event is fired whenever the icecandidate related RTC_EVENTS changed.
|
|
10
|
+
* @type {RTCIceCandidateEvent} for icecandidate related.
|
|
11
|
+
* @param {RTC_ICECANDIDATE_EVENTS} type - The type of event.
|
|
12
|
+
* @param {IRTCDataChannelEventInitDict} eventInitDict - The event init properties.
|
|
13
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection#events MDN} for details.
|
|
14
|
+
*/
|
|
15
|
+
export default class RTCIceCandidateEvent<TEventType extends RTC_ICECANDIDATE_EVENTS> extends Event<TEventType> {
|
|
16
|
+
/** @eventProperty */
|
|
17
|
+
candidate: RTCIceCandidate | null;
|
|
18
|
+
constructor(type: TEventType, eventInitDict: IRTCDataChannelEventInitDict);
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
7
21
|
//# sourceMappingURL=RTCIceCandidateEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTCIceCandidateEvent.d.ts","sourceRoot":"","sources":["../../src/RTCIceCandidateEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RTCIceCandidateEvent.d.ts","sourceRoot":"","sources":["../../src/RTCIceCandidateEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AAErD,KAAK,uBAAuB,GAAG,cAAc,GAAG,mBAAmB,CAAA;AAEnE,UAAU,4BAA6B,SAAQ,KAAK,CAAC,SAAS;IAC1D,SAAS,EAAE,eAAe,GAAG,IAAI,CAAA;CACpC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,oBAAoB,CAAC,UAAU,SAAS,uBAAuB,CAAE,SAAQ,KAAK,CAAC,UAAU,CAAC;IAC3G,qBAAqB;IACrB,SAAS,EAAE,eAAe,GAAG,IAAI,CAAC;gBACtB,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,4BAA4B;CAI5E"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EventTarget } from 'event-target-shim';
|
|
2
2
|
import MediaStream from './MediaStream';
|
|
3
3
|
import MediaStreamTrack from './MediaStreamTrack';
|
|
4
4
|
import RTCDataChannel from './RTCDataChannel';
|
|
5
|
+
import RTCDataChannelEvent from './RTCDataChannelEvent';
|
|
6
|
+
import RTCEvent from './RTCEvent';
|
|
7
|
+
import RTCIceCandidateEvent from './RTCIceCandidateEvent';
|
|
5
8
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
6
9
|
import RTCRtpSender from './RTCRtpSender';
|
|
7
10
|
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
8
11
|
import RTCSessionDescription, { RTCSessionDescriptionInit } from './RTCSessionDescription';
|
|
12
|
+
import RTCTrackEvent from './RTCTrackEvent';
|
|
9
13
|
type RTCSignalingState = 'stable' | 'have-local-offer' | 'have-remote-offer' | 'have-local-pranswer' | 'have-remote-pranswer' | 'closed';
|
|
10
14
|
type RTCIceGatheringState = 'new' | 'gathering' | 'complete';
|
|
11
15
|
type RTCPeerConnectionState = 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed';
|
|
@@ -18,8 +22,19 @@ type RTCDataChannelInit = {
|
|
|
18
22
|
negotiated?: boolean;
|
|
19
23
|
id?: number;
|
|
20
24
|
};
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
type RTCPeerConnectionEventMap = {
|
|
26
|
+
connectionstatechange: RTCEvent<'connectionstatechange'>;
|
|
27
|
+
icecandidate: RTCIceCandidateEvent<'icecandidate'>;
|
|
28
|
+
icecandidateerror: RTCIceCandidateEvent<'icecandidateerror'>;
|
|
29
|
+
iceconnectionstatechange: RTCEvent<'iceconnectionstatechange'>;
|
|
30
|
+
icegatheringstatechange: RTCEvent<'icegatheringstatechange'>;
|
|
31
|
+
negotiationneeded: RTCEvent<'negotiationneeded'>;
|
|
32
|
+
signalingstatechange: RTCEvent<'signalingstatechange'>;
|
|
33
|
+
datachannel: RTCDataChannelEvent<'datachannel'>;
|
|
34
|
+
track: RTCTrackEvent<'track'>;
|
|
35
|
+
error: RTCEvent<'error'>;
|
|
36
|
+
};
|
|
37
|
+
export default class RTCPeerConnection extends EventTarget<RTCPeerConnectionEventMap> {
|
|
23
38
|
localDescription: RTCSessionDescription | null;
|
|
24
39
|
remoteDescription: RTCSessionDescription | null;
|
|
25
40
|
signalingState: RTCSignalingState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTCPeerConnection.d.ts","sourceRoot":"","sources":["../../src/RTCPeerConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"RTCPeerConnection.d.ts","sourceRoot":"","sources":["../../src/RTCPeerConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,qBAAqB,EAAE,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAM5C,KAAK,iBAAiB,GAChB,QAAQ,GACR,kBAAkB,GAClB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,GACtB,QAAQ,CAAC;AAEf,KAAK,oBAAoB,GAAG,KAAK,GAAG,WAAW,GAAG,UAAU,CAAC;AAE7D,KAAK,sBAAsB,GAAG,KAAK,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAExG,KAAK,qBAAqB,GAAG,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC;AAEnH,KAAK,kBAAkB,GAAG;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAA;CACd,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC7B,qBAAqB,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAA;IACxD,YAAY,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAAA;IAClD,iBAAiB,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,CAAA;IAC5D,wBAAwB,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAAA;IAC9D,uBAAuB,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAA;IAC5D,iBAAiB,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAA;IAChD,oBAAoB,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAA;IACtD,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC/C,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IAC7B,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;CACzB,CAAA;AAIH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW,CAAC,yBAAyB,CAAC;IACjF,gBAAgB,EAAE,qBAAqB,GAAG,IAAI,CAAQ;IACtD,iBAAiB,EAAE,qBAAqB,GAAG,IAAI,CAAQ;IACvD,cAAc,EAAE,iBAAiB,CAAY;IAC7C,iBAAiB,EAAE,oBAAoB,CAAS;IAChD,eAAe,EAAE,sBAAsB,CAAS;IAChD,kBAAkB,EAAE,qBAAqB,CAAS;IAElD,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,iBAAiB,CAAA;KAAE,EAAE,CAAC;IACnE,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACzC,mBAAmB,EAAE,GAAG,EAAE,CAAC;gBAEf,aAAa,KAAA;IAkBnB,WAAW,CAAC,OAAO,KAAA;IA+BnB,YAAY;IAalB,gBAAgB,CAAC,aAAa,KAAA,GAAG,IAAI;IAI/B,mBAAmB,CAAC,kBAAkB,CAAC,EAAE,qBAAqB,GAAG,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC1G,oBAAoB,CAAC,kBAAkB,EAAE,qBAAqB,GAAG,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8G1G,eAAe,CAAC,SAAS,KAAA,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB/C;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,GAAG,YAAY;IAwD1E,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,gBAAgB,EAAE,IAAI,KAAA,GAAG,iBAAiB;IAkDrF,WAAW,CAAC,MAAM,EAAE,YAAY;IAmC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB;IAiC1C,eAAe,IAAI,iBAAiB,EAAE;IAItC,UAAU,IAAI,YAAY,EAAE;IAK5B,YAAY,IAAI,cAAc,EAAE;IAKhC,KAAK,IAAI,IAAI;IAeb,UAAU,IAAI,IAAI;IAIlB,eAAe,IAAI,IAAI;IAgKvB;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,kBAAkB,GAAG,cAAc;IAkBtF;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO;IAU9C;;OAEG;IACH,mBAAmB,CAAC,kBAAkB,KAAA,EAAE,aAAa,UAAQ;IA4B7D;;;;OAIG;IACH,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB;CAIzE"}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
|
+
import { Event } from 'event-target-shim';
|
|
1
2
|
import MediaStream from './MediaStream';
|
|
2
3
|
import type MediaStreamTrack from './MediaStreamTrack';
|
|
3
4
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
4
5
|
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
type TRACK_EVENTS = 'track';
|
|
7
|
+
interface IRTCTrackEventInitDict extends Event.EventInit {
|
|
8
|
+
streams: MediaStream[];
|
|
9
|
+
transceiver: RTCRtpTransceiver;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @eventClass
|
|
13
|
+
* This event is fired whenever the Track is changed in PeerConnection.
|
|
14
|
+
* @param {TRACK_EVENTS} type - The type of event.
|
|
15
|
+
* @param {IRTCTrackEventInitDict} eventInitDict - The event init properties.
|
|
16
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/track_event MDN} for details.
|
|
17
|
+
*/
|
|
18
|
+
export default class RTCTrackEvent<TEventType extends TRACK_EVENTS> extends Event<TEventType> {
|
|
19
|
+
/** @eventProperty */
|
|
7
20
|
readonly streams: MediaStream[];
|
|
21
|
+
/** @eventProperty */
|
|
8
22
|
readonly transceiver: RTCRtpTransceiver;
|
|
23
|
+
/** @eventProperty */
|
|
9
24
|
readonly receiver: RTCRtpReceiver | null;
|
|
25
|
+
/** @eventProperty */
|
|
10
26
|
readonly track: MediaStreamTrack | null;
|
|
11
|
-
constructor(type:
|
|
12
|
-
streams: MediaStream[];
|
|
13
|
-
transceiver: RTCRtpTransceiver;
|
|
14
|
-
});
|
|
27
|
+
constructor(type: TEventType, eventInitDict: IRTCTrackEventInitDict);
|
|
15
28
|
}
|
|
29
|
+
export {};
|
|
16
30
|
//# sourceMappingURL=RTCTrackEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTCTrackEvent.d.ts","sourceRoot":"","sources":["../../src/RTCTrackEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RTCTrackEvent.d.ts","sourceRoot":"","sources":["../../src/RTCTrackEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,KAAK,YAAY,GAAG,OAAO,CAAA;AAE3B,UAAU,sBAAuB,SAAQ,KAAK,CAAC,SAAS;IACpD,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,WAAW,EAAE,iBAAiB,CAAA;CACjC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa,CAAC,UAAU,SAAS,YAAY,CAAE,SAAQ,KAAK,CAAC,UAAU,CAAC;IACzF,qBAAqB;IACrB,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,CAAM;IAErC,qBAAqB;IACrB,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC;IAExC,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IAEzC,qBAAqB;IACrB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;gBAE5B,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,sBAAsB;CAOtE"}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.source = { :git => 'git@github.com:react-native-webrtc/react-native-webrtc.git', :tag => 'release #{s.version}' }
|
|
13
13
|
s.requires_arc = true
|
|
14
14
|
|
|
15
|
-
s.platforms = { :ios => '12.0', :osx => '10.13' }
|
|
15
|
+
s.platforms = { :ios => '12.0', :osx => '10.13', :tvos => '16.0' }
|
|
16
16
|
|
|
17
17
|
s.preserve_paths = 'ios/**/*'
|
|
18
18
|
s.source_files = 'ios/**/*.{h,m}'
|
package/src/MediaStream.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
|
|
2
|
-
import
|
|
2
|
+
import EventTarget from 'event-target-shim';
|
|
3
3
|
import { NativeModules } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import MediaStreamTrack from './MediaStreamTrack';
|
|
6
|
+
import MediaStreamTrackEvent from './MediaStreamTrackEvent';
|
|
6
7
|
import { uniqueID } from './RTCUtil';
|
|
7
8
|
|
|
8
9
|
const { WebRTCModule } = NativeModules;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
type MediaStreamEventMap = {
|
|
12
|
+
active: MediaStreamTrackEvent<'active'>
|
|
13
|
+
inactive: MediaStreamTrackEvent<'inactive'>
|
|
14
|
+
addtrack: MediaStreamTrackEvent<'addtrack'>
|
|
15
|
+
removetrack: MediaStreamTrackEvent<'removetrack'>
|
|
16
|
+
}
|
|
11
17
|
|
|
12
|
-
export default class MediaStream extends
|
|
18
|
+
export default class MediaStream extends EventTarget<MediaStreamEventMap> {
|
|
13
19
|
_tracks: MediaStreamTrack[] = [];
|
|
14
20
|
|
|
15
21
|
_id: string;
|
|
@@ -35,7 +41,11 @@ export default class MediaStream extends defineCustomEventTarget(...MEDIA_STREAM
|
|
|
35
41
|
* done internally, when the stream is first created in native and the JS wrapper is
|
|
36
42
|
* built afterwards.
|
|
37
43
|
*/
|
|
38
|
-
constructor(arg
|
|
44
|
+
constructor(arg?:
|
|
45
|
+
MediaStream |
|
|
46
|
+
MediaStreamTrack[] |
|
|
47
|
+
{ streamId: string, streamReactTag: string, tracks: MediaStreamTrack[] }
|
|
48
|
+
) {
|
|
39
49
|
super();
|
|
40
50
|
|
|
41
51
|
// Assign a UUID to start with. It will get overridden for remote streams.
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
import { Event } from 'event-target-shim';
|
|
1
2
|
|
|
2
3
|
import type MediaStreamTrack from './MediaStreamTrack';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
type MEDIA_STREAM_EVENTS = 'active'| 'inactive'| 'addtrack'| 'removetrack'
|
|
6
|
+
|
|
7
|
+
interface IMediaStreamTrackEventInitDict extends Event.EventInit {
|
|
8
|
+
track: MediaStreamTrack;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @eventClass
|
|
13
|
+
* This event is fired whenever the MediaStreamTrack has changed in any way.
|
|
14
|
+
* @param {MEDIA_STREAM_EVENTS} type - The type of event.
|
|
15
|
+
* @param {IMediaStreamTrackEventInitDict} eventInitDict - The event init properties.
|
|
16
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStream#events MDN} for details.
|
|
17
|
+
*/
|
|
18
|
+
export default class MediaStreamTrackEvent<TEventType extends MEDIA_STREAM_EVENTS> extends Event<TEventType> {
|
|
19
|
+
/** @eventProperty */
|
|
6
20
|
track: MediaStreamTrack;
|
|
7
|
-
constructor(type, eventInitDict:
|
|
8
|
-
|
|
21
|
+
constructor(type: TEventType, eventInitDict: IMediaStreamTrackEventInitDict) {
|
|
22
|
+
super(type, eventInitDict);
|
|
9
23
|
this.track = eventInitDict.track;
|
|
10
24
|
}
|
|
11
25
|
}
|
package/src/MessageEvent.ts
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { Event } from 'event-target-shim';
|
|
2
2
|
export type MessageEventData = string | ArrayBuffer | Blob;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type MESSAGE_EVENTS = 'message' | 'messageerror';
|
|
5
|
+
|
|
6
|
+
interface IMessageEventInitDict extends Event.EventInit {
|
|
7
|
+
data: MessageEventData;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @eventClass
|
|
12
|
+
* This event is fired whenever the RTCDataChannel send message.
|
|
13
|
+
* @param {MESSAGE_EVENTS} type - The type of event.
|
|
14
|
+
* @param {IMessageEventInitDict} eventInitDict - The event init properties.
|
|
15
|
+
* @see
|
|
16
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/message_event#event_type MDN} for details.
|
|
17
|
+
*/
|
|
18
|
+
export default class MessageEvent<TEventType extends MESSAGE_EVENTS> extends Event<TEventType> {
|
|
19
|
+
/** @eventProperty */
|
|
6
20
|
data: MessageEventData;
|
|
7
|
-
constructor(type:
|
|
8
|
-
|
|
21
|
+
constructor(type: TEventType, eventInitDict: IMessageEventInitDict) {
|
|
22
|
+
super(type, eventInitDict);
|
|
9
23
|
this.data = eventInitDict.data;
|
|
10
24
|
}
|
|
11
25
|
}
|
package/src/RTCDataChannel.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import * as base64 from 'base64-js';
|
|
3
|
-
import {
|
|
3
|
+
import { EventTarget } from 'event-target-shim';
|
|
4
4
|
import { NativeModules } from 'react-native';
|
|
5
5
|
|
|
6
6
|
import { addListener, removeListener } from './EventEmitter';
|
|
@@ -11,9 +11,16 @@ const { WebRTCModule } = NativeModules;
|
|
|
11
11
|
|
|
12
12
|
type RTCDataChannelState = 'connecting' | 'open' | 'closing' | 'closed';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
type DataChannelEventMap = {
|
|
15
|
+
bufferedamountlow: RTCDataChannelEvent<'bufferedamountlow'>;
|
|
16
|
+
close: RTCDataChannelEvent<'close'>;
|
|
17
|
+
closing: RTCDataChannelEvent<'closing'>;
|
|
18
|
+
error: RTCDataChannelEvent<'error'>;
|
|
19
|
+
message: MessageEvent<'message'>;
|
|
20
|
+
open: RTCDataChannelEvent<'open'>;
|
|
21
|
+
};
|
|
15
22
|
|
|
16
|
-
export default class RTCDataChannel extends
|
|
23
|
+
export default class RTCDataChannel extends EventTarget<DataChannelEventMap> {
|
|
17
24
|
_peerConnectionId: number;
|
|
18
25
|
_reactTag: string;
|
|
19
26
|
|
|
@@ -130,13 +137,10 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
|
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
if (this._readyState === 'open') {
|
|
133
|
-
// @ts-ignore
|
|
134
140
|
this.dispatchEvent(new RTCDataChannelEvent('open', { channel: this }));
|
|
135
141
|
} else if (this._readyState === 'closing') {
|
|
136
|
-
// @ts-ignore
|
|
137
142
|
this.dispatchEvent(new RTCDataChannelEvent('closing', { channel: this }));
|
|
138
143
|
} else if (this._readyState === 'closed') {
|
|
139
|
-
// @ts-ignore
|
|
140
144
|
this.dispatchEvent(new RTCDataChannelEvent('close', { channel: this }));
|
|
141
145
|
|
|
142
146
|
// This DataChannel is done, clean up event handlers.
|
|
@@ -157,7 +161,6 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
|
|
|
157
161
|
data = base64.toByteArray(ev.data).buffer;
|
|
158
162
|
}
|
|
159
163
|
|
|
160
|
-
// @ts-ignore
|
|
161
164
|
this.dispatchEvent(new MessageEvent('message', { data }));
|
|
162
165
|
});
|
|
163
166
|
|
|
@@ -169,7 +172,6 @@ export default class RTCDataChannel extends defineCustomEventTarget(...DATA_CHAN
|
|
|
169
172
|
this._bufferedAmount = ev.bufferedAmount;
|
|
170
173
|
|
|
171
174
|
if (this._bufferedAmount < this.bufferedAmountLowThreshold) {
|
|
172
|
-
// @ts-ignore
|
|
173
175
|
this.dispatchEvent(new RTCDataChannelEvent('bufferedamountlow', { channel: this }));
|
|
174
176
|
}
|
|
175
177
|
});
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
import { Event } from 'event-target-shim';
|
|
1
2
|
|
|
2
3
|
import type RTCDataChannel from './RTCDataChannel';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
type DATA_CHANNEL_EVENTS = 'open'| 'message'| 'bufferedamountlow'| 'closing'| 'close'| 'error' | 'datachannel';
|
|
6
|
+
|
|
7
|
+
interface IRTCDataChannelEventInitDict extends Event.EventInit {
|
|
8
|
+
channel: RTCDataChannel;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @eventClass
|
|
14
|
+
* This event is fired whenever the RTCDataChannel has changed in any way.
|
|
15
|
+
* @param {DATA_CHANNEL_EVENTS} type - The type of event.
|
|
16
|
+
* @param {IRTCDataChannelEventInitDict} eventInitDict - The event init properties.
|
|
17
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel#events MDN} for details.
|
|
18
|
+
*/
|
|
19
|
+
export default class RTCDataChannelEvent<
|
|
20
|
+
TEventType extends DATA_CHANNEL_EVENTS
|
|
21
|
+
> extends Event<TEventType> {
|
|
22
|
+
/** @eventProperty */
|
|
6
23
|
channel: RTCDataChannel;
|
|
7
|
-
constructor(type, eventInitDict:
|
|
8
|
-
|
|
24
|
+
constructor(type: TEventType, eventInitDict: IRTCDataChannelEventInitDict) {
|
|
25
|
+
super(type, eventInitDict);
|
|
9
26
|
this.channel = eventInitDict.channel;
|
|
10
27
|
}
|
|
11
28
|
}
|
package/src/RTCErrorEvent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Event } from 'event-target-shim';
|
|
2
2
|
|
|
3
3
|
type RTCPeerConnectionErrorFunc =
|
|
4
4
|
| 'addTransceiver'
|
|
@@ -10,10 +10,10 @@ type RTCPeerConnectionErrorFunc =
|
|
|
10
10
|
* @brief This class Represents internal error happening on the native side as
|
|
11
11
|
* part of asynchronous invocations to synchronous web APIs.
|
|
12
12
|
*/
|
|
13
|
-
export default class RTCErrorEvent extends
|
|
13
|
+
export default class RTCErrorEvent<TEventType extends RTCPeerConnectionErrorFunc> extends Event<TEventType> {
|
|
14
14
|
readonly func: RTCPeerConnectionErrorFunc;
|
|
15
15
|
readonly message: string;
|
|
16
|
-
constructor(type:
|
|
16
|
+
constructor(type: TEventType, func: RTCPeerConnectionErrorFunc, message: string) {
|
|
17
17
|
super(type);
|
|
18
18
|
this.func = func;
|
|
19
19
|
this.message = message;
|
package/src/RTCEvent.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import { Event } from 'event-target-shim';
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
// Import for documentation purposes
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import RTCIceCandidateEvent from './RTCIceCandidateEvent';
|
|
6
|
+
|
|
7
|
+
type RTC_EVENTS = 'connectionstatechange' | 'iceconnectionstatechange' | 'icegatheringstatechange' |
|
|
8
|
+
'negotiationneeded' | 'signalingstatechange' | 'error'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @eventClass
|
|
12
|
+
* This event is fired whenever the RTC_EVENTS has changed except on icecandidate related.
|
|
13
|
+
* @type {RTCIceCandidateEvent} for icecandidate related.
|
|
14
|
+
* @param {RTC_EVENTS} type - The type of event.
|
|
15
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection#events MDN} for details.
|
|
16
|
+
*/
|
|
17
|
+
export default class RTCEvent<TEventType extends RTC_EVENTS> extends Event<TEventType> {
|
|
18
|
+
constructor(type: TEventType, eventInitDict?: Event.EventInit) {
|
|
19
|
+
super(type, eventInitDict);
|
|
6
20
|
}
|
|
7
21
|
}
|
package/src/RTCIceCandidate.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
interface RTCIceCandidateInfo {
|
|
2
|
+
candidate?: string;
|
|
3
|
+
sdpMLineIndex?: number | null;
|
|
4
|
+
sdpMid?: string | null;
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
export default class RTCIceCandidate {
|
|
2
8
|
candidate: string;
|
|
3
9
|
sdpMLineIndex: number;
|
|
4
10
|
sdpMid: string;
|
|
5
11
|
|
|
6
|
-
constructor({ candidate = '', sdpMLineIndex = null, sdpMid = null }) {
|
|
12
|
+
constructor({ candidate = '', sdpMLineIndex = null, sdpMid = null }: RTCIceCandidateInfo) {
|
|
7
13
|
if (sdpMLineIndex === null || sdpMid === null) {
|
|
8
14
|
throw new TypeError('`sdpMLineIndex` and `sdpMid` must not null');
|
|
9
15
|
}
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
import { Event } from 'event-target-shim';
|
|
1
2
|
|
|
2
3
|
import type RTCIceCandidate from './RTCIceCandidate';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
type RTC_ICECANDIDATE_EVENTS = 'icecandidate' | 'icecandidateerror'
|
|
6
|
+
|
|
7
|
+
interface IRTCDataChannelEventInitDict extends Event.EventInit {
|
|
8
|
+
candidate: RTCIceCandidate | null
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @eventClass
|
|
13
|
+
* This event is fired whenever the icecandidate related RTC_EVENTS changed.
|
|
14
|
+
* @type {RTCIceCandidateEvent} for icecandidate related.
|
|
15
|
+
* @param {RTC_ICECANDIDATE_EVENTS} type - The type of event.
|
|
16
|
+
* @param {IRTCDataChannelEventInitDict} eventInitDict - The event init properties.
|
|
17
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection#events MDN} for details.
|
|
18
|
+
*/
|
|
19
|
+
export default class RTCIceCandidateEvent<TEventType extends RTC_ICECANDIDATE_EVENTS> extends Event<TEventType> {
|
|
20
|
+
/** @eventProperty */
|
|
6
21
|
candidate: RTCIceCandidate | null;
|
|
7
|
-
constructor(type, eventInitDict) {
|
|
8
|
-
|
|
22
|
+
constructor(type: TEventType, eventInitDict: IRTCDataChannelEventInitDict) {
|
|
23
|
+
super(type, eventInitDict);
|
|
9
24
|
this.candidate = eventInitDict?.candidate ?? null;
|
|
10
25
|
}
|
|
11
26
|
}
|
package/src/RTCPeerConnection.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { EventTarget } from 'event-target-shim';
|
|
3
3
|
import { NativeModules } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { addListener, removeListener } from './EventEmitter';
|
|
@@ -47,25 +47,24 @@ type RTCDataChannelInit = {
|
|
|
47
47
|
id?: number
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
'connectionstatechange'
|
|
52
|
-
'icecandidate'
|
|
53
|
-
'icecandidateerror'
|
|
54
|
-
'iceconnectionstatechange'
|
|
55
|
-
'icegatheringstatechange'
|
|
56
|
-
'negotiationneeded'
|
|
57
|
-
'signalingstatechange'
|
|
58
|
-
'datachannel'
|
|
59
|
-
'track'
|
|
60
|
-
'error'
|
|
61
|
-
|
|
50
|
+
type RTCPeerConnectionEventMap = {
|
|
51
|
+
connectionstatechange: RTCEvent<'connectionstatechange'>
|
|
52
|
+
icecandidate: RTCIceCandidateEvent<'icecandidate'>
|
|
53
|
+
icecandidateerror: RTCIceCandidateEvent<'icecandidateerror'>
|
|
54
|
+
iceconnectionstatechange: RTCEvent<'iceconnectionstatechange'>
|
|
55
|
+
icegatheringstatechange: RTCEvent<'icegatheringstatechange'>
|
|
56
|
+
negotiationneeded: RTCEvent<'negotiationneeded'>
|
|
57
|
+
signalingstatechange: RTCEvent<'signalingstatechange'>
|
|
58
|
+
datachannel: RTCDataChannelEvent<'datachannel'>
|
|
59
|
+
track: RTCTrackEvent<'track'>
|
|
60
|
+
error: RTCEvent<'error'>
|
|
61
|
+
}
|
|
62
62
|
|
|
63
63
|
let nextPeerConnectionId = 0;
|
|
64
64
|
|
|
65
|
-
export default class RTCPeerConnection extends
|
|
65
|
+
export default class RTCPeerConnection extends EventTarget<RTCPeerConnectionEventMap> {
|
|
66
66
|
localDescription: RTCSessionDescription | null = null;
|
|
67
67
|
remoteDescription: RTCSessionDescription | null = null;
|
|
68
|
-
|
|
69
68
|
signalingState: RTCSignalingState = 'stable';
|
|
70
69
|
iceGatheringState: RTCIceGatheringState = 'new';
|
|
71
70
|
connectionState: RTCPeerConnectionState = 'new';
|
|
@@ -80,7 +79,10 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
80
79
|
super();
|
|
81
80
|
|
|
82
81
|
this._pcId = nextPeerConnectionId++;
|
|
83
|
-
|
|
82
|
+
|
|
83
|
+
if (!WebRTCModule.peerConnectionInit(configuration, this._pcId)) {
|
|
84
|
+
throw new Error('Failed to initialize PeerConnection, check the native logs!');
|
|
85
|
+
}
|
|
84
86
|
|
|
85
87
|
this._transceivers = [];
|
|
86
88
|
this._remoteStreams = new Map();
|
|
@@ -269,11 +271,10 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
269
271
|
receiver: transceiver.receiver
|
|
270
272
|
};
|
|
271
273
|
|
|
272
|
-
|
|
274
|
+
|
|
273
275
|
this.dispatchEvent(new RTCTrackEvent('track', eventData));
|
|
274
276
|
|
|
275
277
|
streams.forEach(stream => {
|
|
276
|
-
// @ts-ignore
|
|
277
278
|
stream.dispatchEvent(new MediaStreamTrackEvent('addtrack', { track }));
|
|
278
279
|
});
|
|
279
280
|
|
|
@@ -530,7 +531,6 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
530
531
|
return;
|
|
531
532
|
}
|
|
532
533
|
|
|
533
|
-
// @ts-ignore
|
|
534
534
|
this.dispatchEvent(new RTCEvent('negotiationneeded'));
|
|
535
535
|
});
|
|
536
536
|
|
|
@@ -541,7 +541,6 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
541
541
|
|
|
542
542
|
this.iceConnectionState = ev.iceConnectionState;
|
|
543
543
|
|
|
544
|
-
// @ts-ignore
|
|
545
544
|
this.dispatchEvent(new RTCEvent('iceconnectionstatechange'));
|
|
546
545
|
});
|
|
547
546
|
|
|
@@ -552,7 +551,6 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
552
551
|
|
|
553
552
|
this.connectionState = ev.connectionState;
|
|
554
553
|
|
|
555
|
-
// @ts-ignore
|
|
556
554
|
this.dispatchEvent(new RTCEvent('connectionstatechange'));
|
|
557
555
|
|
|
558
556
|
if (ev.connectionState === 'closed') {
|
|
@@ -569,7 +567,7 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
569
567
|
}
|
|
570
568
|
|
|
571
569
|
this.signalingState = ev.signalingState;
|
|
572
|
-
|
|
570
|
+
|
|
573
571
|
this.dispatchEvent(new RTCEvent('signalingstatechange'));
|
|
574
572
|
});
|
|
575
573
|
|
|
@@ -611,7 +609,6 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
611
609
|
|
|
612
610
|
stream._tracks.splice(trackIdx, 1);
|
|
613
611
|
|
|
614
|
-
// @ts-ignore
|
|
615
612
|
stream.dispatchEvent(new MediaStreamTrackEvent('removetrack', { track }));
|
|
616
613
|
|
|
617
614
|
// Dispatch a mute event for the track.
|
|
@@ -637,7 +634,6 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
637
634
|
|
|
638
635
|
const candidate = new RTCIceCandidate(ev.candidate);
|
|
639
636
|
|
|
640
|
-
// @ts-ignore
|
|
641
637
|
this.dispatchEvent(new RTCIceCandidateEvent('icecandidate', { candidate }));
|
|
642
638
|
});
|
|
643
639
|
|
|
@@ -658,11 +654,9 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
658
654
|
this.localDescription = null;
|
|
659
655
|
}
|
|
660
656
|
|
|
661
|
-
// @ts-ignore
|
|
662
657
|
this.dispatchEvent(new RTCIceCandidateEvent('icecandidate', { candidate: null }));
|
|
663
658
|
}
|
|
664
659
|
|
|
665
|
-
// @ts-ignore
|
|
666
660
|
this.dispatchEvent(new RTCEvent('icegatheringstatechange'));
|
|
667
661
|
});
|
|
668
662
|
|
|
@@ -673,7 +667,6 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
673
667
|
|
|
674
668
|
const channel = new RTCDataChannel(ev.dataChannel);
|
|
675
669
|
|
|
676
|
-
// @ts-ignore
|
|
677
670
|
this.dispatchEvent(new RTCDataChannelEvent('datachannel', { channel }));
|
|
678
671
|
});
|
|
679
672
|
|
package/src/RTCTrackEvent.ts
CHANGED
|
@@ -1,18 +1,39 @@
|
|
|
1
|
+
import { Event } from 'event-target-shim';
|
|
1
2
|
|
|
2
3
|
import MediaStream from './MediaStream';
|
|
3
4
|
import type MediaStreamTrack from './MediaStreamTrack';
|
|
4
5
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
5
6
|
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
type TRACK_EVENTS = 'track'
|
|
9
|
+
|
|
10
|
+
interface IRTCTrackEventInitDict extends Event.EventInit {
|
|
11
|
+
streams: MediaStream[]
|
|
12
|
+
transceiver: RTCRtpTransceiver
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @eventClass
|
|
17
|
+
* This event is fired whenever the Track is changed in PeerConnection.
|
|
18
|
+
* @param {TRACK_EVENTS} type - The type of event.
|
|
19
|
+
* @param {IRTCTrackEventInitDict} eventInitDict - The event init properties.
|
|
20
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/track_event MDN} for details.
|
|
21
|
+
*/
|
|
22
|
+
export default class RTCTrackEvent<TEventType extends TRACK_EVENTS> extends Event<TEventType> {
|
|
23
|
+
/** @eventProperty */
|
|
9
24
|
readonly streams: MediaStream[] = [];
|
|
25
|
+
|
|
26
|
+
/** @eventProperty */
|
|
10
27
|
readonly transceiver: RTCRtpTransceiver;
|
|
28
|
+
|
|
29
|
+
/** @eventProperty */
|
|
11
30
|
readonly receiver: RTCRtpReceiver | null;
|
|
31
|
+
|
|
32
|
+
/** @eventProperty */
|
|
12
33
|
readonly track: MediaStreamTrack | null;
|
|
13
34
|
|
|
14
|
-
constructor(type:
|
|
15
|
-
|
|
35
|
+
constructor(type: TEventType, eventInitDict: IRTCTrackEventInitDict) {
|
|
36
|
+
super(type, eventInitDict);
|
|
16
37
|
this.streams = eventInitDict.streams;
|
|
17
38
|
this.transceiver = eventInitDict.transceiver;
|
|
18
39
|
this.receiver = eventInitDict.transceiver.receiver;
|