react-native-webrtc 106.0.0-beta.3 → 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/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +65 -26
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +3 -0
- package/ios/RCTWebRTC/SerializeUtils.m +18 -5
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +34 -2
- package/ios/RCTWebRTC/WebRTCModule+Transceivers.m +5 -4
- package/lib/commonjs/RTCPeerConnection.js +4 -1
- 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/RTCRtpCodecParameters.js +22 -4
- package/lib/commonjs/RTCRtpCodecParameters.js.map +1 -1
- package/lib/commonjs/RTCRtpEncodingParameters.js +12 -1
- 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 +16 -2
- 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 +1 -1
- package/lib/commonjs/RTCRtpSender.js.map +1 -1
- package/lib/commonjs/index.js +0 -81
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/RTCPeerConnection.js +3 -1
- 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/RTCRtpCodecParameters.js +22 -4
- package/lib/module/RTCRtpCodecParameters.js.map +1 -1
- package/lib/module/RTCRtpEncodingParameters.js +12 -1
- 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.map +1 -1
- package/lib/module/RTCRtpReceiver.js +13 -2
- package/lib/module/RTCRtpReceiver.js.map +1 -1
- package/lib/module/RTCRtpSendParameters.js +9 -4
- package/lib/module/RTCRtpSendParameters.js.map +1 -1
- package/lib/module/RTCRtpSender.js +1 -1
- package/lib/module/RTCRtpSender.js.map +1 -1
- package/lib/module/index.js +1 -19
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/RTCPeerConnection.d.ts +1 -1
- package/lib/typescript/RTCRtcpParameters.d.ts +6 -4
- package/lib/typescript/RTCRtpCodecParameters.d.ts +11 -9
- package/lib/typescript/RTCRtpEncodingParameters.d.ts +11 -9
- package/lib/typescript/RTCRtpHeaderExtension.d.ts +7 -5
- package/lib/typescript/RTCRtpParameters.d.ts +9 -8
- package/lib/typescript/RTCRtpReceiver.d.ts +8 -3
- package/lib/typescript/RTCRtpSendParameters.d.ts +8 -9
- package/lib/typescript/RTCRtpSender.d.ts +2 -2
- package/lib/typescript/index.d.ts +1 -10
- package/package.json +1 -1
- package/src/RTCPeerConnection.ts +3 -1
- package/src/RTCRtcpParameters.ts +14 -5
- package/src/RTCRtpCodecParameters.ts +34 -13
- package/src/RTCRtpEncodingParameters.ts +19 -7
- package/src/RTCRtpHeaderExtension.ts +15 -6
- package/src/RTCRtpParameters.ts +26 -11
- package/src/RTCRtpReceiveParameters.ts +2 -1
- package/src/RTCRtpReceiver.ts +20 -4
- package/src/RTCRtpSendParameters.ts +22 -12
- package/src/RTCRtpSender.ts +3 -4
- package/src/index.ts +0 -27
package/lib/module/index.js
CHANGED
|
@@ -6,16 +6,7 @@ import permissions from './Permissions';
|
|
|
6
6
|
import RTCErrorEvent from './RTCErrorEvent';
|
|
7
7
|
import RTCIceCandidate from './RTCIceCandidate';
|
|
8
8
|
import RTCPeerConnection from './RTCPeerConnection';
|
|
9
|
-
import RTCRtcpParameters from './RTCRtcpParameters';
|
|
10
|
-
import RTCRtpCapabilities from './RTCRtpCapabilities';
|
|
11
|
-
import RTCRtpCodecCapability from './RTCRtpCodecCapability';
|
|
12
|
-
import RTCRtpCodecParameters from './RTCRtpCodecParameters';
|
|
13
|
-
import RTCRtpEncodingParameters from './RTCRtpEncodingParameters';
|
|
14
|
-
import RTCRtpHeaderExtension from './RTCRtpHeaderExtension';
|
|
15
|
-
import RTCRtpParameters from './RTCRtpParameters';
|
|
16
|
-
import RTCRtpReceiveParameters from './RTCRtpReceiveParameters';
|
|
17
9
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
18
|
-
import RTCRtpSendParameters from './RTCRtpSendParameters';
|
|
19
10
|
import RTCRtpSender from './RTCRtpSender';
|
|
20
11
|
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
21
12
|
import RTCSessionDescription from './RTCSessionDescription';
|
|
@@ -23,7 +14,7 @@ import RTCView from './RTCView';
|
|
|
23
14
|
import ScreenCapturePickerView from './ScreenCapturePickerView';
|
|
24
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":["Logger","mediaDevices","MediaStream","MediaStreamTrack","permissions","RTCErrorEvent","RTCIceCandidate","RTCPeerConnection","
|
|
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"]}
|
|
@@ -75,7 +75,7 @@ export default class RTCPeerConnection extends RTCPeerConnection_base {
|
|
|
75
75
|
*/
|
|
76
76
|
_trackExists(track: MediaStreamTrack): boolean;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Updates transceivers after offer/answer updates if necessary.
|
|
79
79
|
*/
|
|
80
80
|
_updateTransceivers(transceiverUpdates: any): void;
|
|
81
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
17
|
set maxFramerate(framerate: number | null);
|
|
14
18
|
get maxBitrate(): number | null;
|
|
15
19
|
set maxBitrate(bitrate: number | null);
|
|
16
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 './RTCRtcpParameters';
|
|
2
|
-
import RTCRtpCodecParameters from './RTCRtpCodecParameters';
|
|
3
|
-
import RTCRtpHeaderExtension from './RTCRtpHeaderExtension';
|
|
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,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
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 RTCRtpEncodingParameters from './RTCRtpEncodingParameters';
|
|
1
|
+
import RTCRtpEncodingParameters, { RTCRtpEncodingParametersInit } from './RTCRtpEncodingParameters';
|
|
2
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,7 +10,7 @@ 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
16
|
static getCapabilities(kind: 'audio' | 'video'): RTCRtpCapabilities;
|
|
@@ -5,20 +5,11 @@ import permissions from './Permissions';
|
|
|
5
5
|
import RTCErrorEvent from './RTCErrorEvent';
|
|
6
6
|
import RTCIceCandidate from './RTCIceCandidate';
|
|
7
7
|
import RTCPeerConnection from './RTCPeerConnection';
|
|
8
|
-
import RTCRtcpParameters from './RTCRtcpParameters';
|
|
9
|
-
import RTCRtpCapabilities from './RTCRtpCapabilities';
|
|
10
|
-
import RTCRtpCodecCapability from './RTCRtpCodecCapability';
|
|
11
|
-
import RTCRtpCodecParameters from './RTCRtpCodecParameters';
|
|
12
|
-
import RTCRtpEncodingParameters from './RTCRtpEncodingParameters';
|
|
13
|
-
import RTCRtpHeaderExtension from './RTCRtpHeaderExtension';
|
|
14
|
-
import RTCRtpParameters from './RTCRtpParameters';
|
|
15
|
-
import RTCRtpReceiveParameters from './RTCRtpReceiveParameters';
|
|
16
8
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
17
|
-
import RTCRtpSendParameters from './RTCRtpSendParameters';
|
|
18
9
|
import RTCRtpSender from './RTCRtpSender';
|
|
19
10
|
import RTCRtpTransceiver from './RTCRtpTransceiver';
|
|
20
11
|
import RTCSessionDescription from './RTCSessionDescription';
|
|
21
12
|
import RTCView from './RTCView';
|
|
22
13
|
import ScreenCapturePickerView from './ScreenCapturePickerView';
|
|
23
|
-
export { RTCIceCandidate, RTCPeerConnection, RTCSessionDescription, RTCView, ScreenCapturePickerView, RTCRtpTransceiver, RTCRtpReceiver, RTCRtpSender, RTCErrorEvent,
|
|
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
package/src/RTCPeerConnection.ts
CHANGED
|
@@ -13,6 +13,7 @@ import RTCErrorEvent from './RTCErrorEvent';
|
|
|
13
13
|
import RTCEvent from './RTCEvent';
|
|
14
14
|
import RTCIceCandidate from './RTCIceCandidate';
|
|
15
15
|
import RTCIceCandidateEvent from './RTCIceCandidateEvent';
|
|
16
|
+
import RTCRtpReceiveParameters from './RTCRtpReceiveParameters';
|
|
16
17
|
import RTCRtpReceiver from './RTCRtpReceiver';
|
|
17
18
|
import RTCRtpSendParameters from './RTCRtpSendParameters';
|
|
18
19
|
import RTCRtpSender from './RTCRtpSender';
|
|
@@ -691,7 +692,7 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
691
692
|
}
|
|
692
693
|
|
|
693
694
|
/**
|
|
694
|
-
*
|
|
695
|
+
* Updates transceivers after offer/answer updates if necessary.
|
|
695
696
|
*/
|
|
696
697
|
_updateTransceivers(transceiverUpdates) {
|
|
697
698
|
for (const update of transceiverUpdates) {
|
|
@@ -706,6 +707,7 @@ export default class RTCPeerConnection extends defineCustomEventTarget(...PEER_C
|
|
|
706
707
|
transceiver._currentDirection = update.currentDirection;
|
|
707
708
|
transceiver._mid = update.mid;
|
|
708
709
|
transceiver._sender._rtpParameters = new RTCRtpSendParameters(update.senderRtpParameters);
|
|
710
|
+
transceiver._receiver._rtpParameters = new RTCRtpReceiveParameters(update.receiverRtpParameters);
|
|
709
711
|
}
|
|
710
712
|
}
|
|
711
713
|
|
package/src/RTCRtcpParameters.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
export interface RTCRtcpParametersInit {
|
|
2
|
+
cname: string;
|
|
3
|
+
reducedSize: boolean;
|
|
4
|
+
}
|
|
1
5
|
|
|
2
6
|
export default class RTCRtcpParameters {
|
|
3
7
|
readonly cname: string;
|
|
4
8
|
readonly reducedSize: boolean;
|
|
5
9
|
|
|
6
|
-
constructor(init: {
|
|
7
|
-
cname: string,
|
|
8
|
-
reducedSize: boolean
|
|
9
|
-
}) {
|
|
10
|
+
constructor(init: RTCRtcpParametersInit) {
|
|
10
11
|
this.cname = init.cname;
|
|
11
12
|
this.reducedSize = init.reducedSize;
|
|
13
|
+
|
|
12
14
|
Object.freeze(this);
|
|
13
15
|
}
|
|
14
|
-
|
|
16
|
+
|
|
17
|
+
toJSON(): RTCRtcpParametersInit {
|
|
18
|
+
return {
|
|
19
|
+
cname: this.cname,
|
|
20
|
+
reducedSize: this.reducedSize
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,23 +1,44 @@
|
|
|
1
|
+
export interface RTCRtpCodecParametersInit {
|
|
2
|
+
payloadType: number;
|
|
3
|
+
clockRate: number;
|
|
4
|
+
mimeType: string;
|
|
5
|
+
channels?: number;
|
|
6
|
+
sdpFmtpLine?: string;
|
|
7
|
+
}
|
|
1
8
|
|
|
2
9
|
export default class RTCRtpCodecParameters {
|
|
3
10
|
readonly payloadType: number;
|
|
4
11
|
readonly clockRate: number;
|
|
5
|
-
readonly channels: number;
|
|
6
12
|
readonly mimeType: string;
|
|
7
|
-
readonly
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
clockRate: number,
|
|
12
|
-
channels: number,
|
|
13
|
-
mimeType: string,
|
|
14
|
-
sdpFmtpLine: Map<string, string>
|
|
15
|
-
}) {
|
|
13
|
+
readonly channels: number | null;
|
|
14
|
+
readonly sdpFmtpLine: string | null;
|
|
15
|
+
|
|
16
|
+
constructor(init: RTCRtpCodecParametersInit) {
|
|
16
17
|
this.payloadType = init.payloadType;
|
|
17
18
|
this.clockRate = init.clockRate;
|
|
18
|
-
this.channels = init.channels;
|
|
19
19
|
this.mimeType = init.mimeType;
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
this.channels = init.channels ? init.channels : null;
|
|
22
|
+
this.sdpFmtpLine = init.sdpFmtpLine ? init.sdpFmtpLine : null;
|
|
23
|
+
|
|
21
24
|
Object.freeze(this);
|
|
22
25
|
}
|
|
23
|
-
|
|
26
|
+
|
|
27
|
+
toJSON(): RTCRtpCodecParametersInit {
|
|
28
|
+
const obj = {
|
|
29
|
+
payloadType: this.payloadType,
|
|
30
|
+
clockRate: this.clockRate,
|
|
31
|
+
mimeType: this.mimeType
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
if (this.channels !== null) {
|
|
35
|
+
obj['channels'] = this.channels;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (this.sdpFmtpLine !== null) {
|
|
39
|
+
obj['sdpFmtpLine'] = this.sdpFmtpLine;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return obj;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
+
export interface RTCRtpEncodingParametersInit {
|
|
2
|
+
active: boolean,
|
|
3
|
+
rid?: string;
|
|
4
|
+
maxFramerate?: number;
|
|
5
|
+
maxBitrate?: number;
|
|
6
|
+
scaleResolutionDownBy?: number;
|
|
7
|
+
}
|
|
1
8
|
|
|
2
9
|
export default class RTCRtpEncodingParameters {
|
|
3
10
|
readonly active: boolean;
|
|
11
|
+
_rid: string | null;
|
|
4
12
|
_maxFramerate: number | null;
|
|
5
13
|
_maxBitrate: number | null;
|
|
6
14
|
_scaleResolutionDownBy: number | null;
|
|
7
15
|
|
|
8
|
-
constructor(init: {
|
|
9
|
-
active: boolean,
|
|
10
|
-
maxFramerate?: number;
|
|
11
|
-
maxBitrate?: number;
|
|
12
|
-
scaleResolutionDownBy?: number;
|
|
13
|
-
}) {
|
|
16
|
+
constructor(init: RTCRtpEncodingParametersInit) {
|
|
14
17
|
this.active = init.active;
|
|
18
|
+
this._rid = init.rid ?? null;
|
|
15
19
|
this._maxBitrate = init.maxBitrate ?? null;
|
|
16
20
|
this._maxFramerate = init.maxFramerate ?? null;
|
|
17
21
|
this._scaleResolutionDownBy = init.scaleResolutionDownBy ?? null;
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
get rid() {
|
|
25
|
+
return this._rid;
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
get maxFramerate() {
|
|
21
29
|
return this._maxFramerate;
|
|
22
30
|
}
|
|
@@ -47,11 +55,15 @@ export default class RTCRtpEncodingParameters {
|
|
|
47
55
|
}
|
|
48
56
|
}
|
|
49
57
|
|
|
50
|
-
toJSON() {
|
|
58
|
+
toJSON(): RTCRtpEncodingParametersInit {
|
|
51
59
|
const obj = {
|
|
52
60
|
active: this.active,
|
|
53
61
|
};
|
|
54
62
|
|
|
63
|
+
if (this._rid !== null) {
|
|
64
|
+
obj['rid'] = this._rid;
|
|
65
|
+
}
|
|
66
|
+
|
|
55
67
|
if (this._maxBitrate !== null) {
|
|
56
68
|
obj['maxBitrate'] = this._maxBitrate;
|
|
57
69
|
}
|
|
@@ -1,18 +1,27 @@
|
|
|
1
|
+
export interface RTCRtpHeaderExtensionInit {
|
|
2
|
+
id: number;
|
|
3
|
+
uri: string;
|
|
4
|
+
encrypted: boolean;
|
|
5
|
+
}
|
|
1
6
|
|
|
2
7
|
export default class RTCRtpHeaderExtension {
|
|
3
8
|
readonly id: number;
|
|
4
9
|
readonly uri: string;
|
|
5
10
|
readonly encrypted: boolean;
|
|
6
11
|
|
|
7
|
-
constructor(init: {
|
|
8
|
-
id: number,
|
|
9
|
-
uri: string,
|
|
10
|
-
encrypted: boolean
|
|
11
|
-
}) {
|
|
12
|
+
constructor(init: RTCRtpHeaderExtensionInit) {
|
|
12
13
|
this.id = init.id;
|
|
13
14
|
this.uri = init.uri;
|
|
14
15
|
this.encrypted = init.encrypted;
|
|
16
|
+
|
|
15
17
|
Object.freeze(this);
|
|
16
18
|
}
|
|
17
|
-
}
|
|
18
19
|
|
|
20
|
+
toJSON(): RTCRtpHeaderExtensionInit {
|
|
21
|
+
return {
|
|
22
|
+
id: this.id,
|
|
23
|
+
uri: this.uri,
|
|
24
|
+
encrypted: this.encrypted
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/RTCRtpParameters.ts
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
|
-
import RTCRtcpParameters from './RTCRtcpParameters';
|
|
2
|
-
import RTCRtpCodecParameters from './RTCRtpCodecParameters';
|
|
3
|
-
import RTCRtpHeaderExtension from './RTCRtpHeaderExtension';
|
|
1
|
+
import RTCRtcpParameters, { RTCRtcpParametersInit } from './RTCRtcpParameters';
|
|
2
|
+
import RTCRtpCodecParameters, { RTCRtpCodecParametersInit } from './RTCRtpCodecParameters';
|
|
3
|
+
import RTCRtpHeaderExtension, { RTCRtpHeaderExtensionInit } from './RTCRtpHeaderExtension';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
codecs:
|
|
8
|
-
headerExtensions:
|
|
9
|
-
rtcp:
|
|
6
|
+
export interface RTCRtpParametersInit {
|
|
7
|
+
codecs: RTCRtpCodecParametersInit[],
|
|
8
|
+
headerExtensions: RTCRtpHeaderExtensionInit[],
|
|
9
|
+
rtcp: RTCRtcpParametersInit
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export default class RTCRtpParameters {
|
|
13
13
|
readonly codecs: RTCRtpCodecParameters[] = [];
|
|
14
14
|
readonly headerExtensions: RTCRtpHeaderExtension[] = [];
|
|
15
15
|
readonly rtcp: RTCRtcpParameters;
|
|
16
|
+
|
|
16
17
|
constructor(init: RTCRtpParametersInit) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
for (const codec of init.codecs) {
|
|
19
|
+
this.codecs.push(new RTCRtpCodecParameters(codec));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
for (const ext of init.headerExtensions) {
|
|
23
|
+
this.headerExtensions.push(new RTCRtpHeaderExtension(ext));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.rtcp = new RTCRtcpParameters(init.rtcp);
|
|
20
27
|
}
|
|
21
|
-
|
|
28
|
+
|
|
29
|
+
toJSON(): RTCRtpParametersInit {
|
|
30
|
+
return {
|
|
31
|
+
codecs: this.codecs.map(c => c.toJSON()),
|
|
32
|
+
headerExtensions: this.headerExtensions.map(he => he.toJSON()),
|
|
33
|
+
rtcp: this.rtcp.toJSON()
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/RTCRtpReceiver.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import MediaStreamTrack from './MediaStreamTrack';
|
|
2
2
|
import RTCRtpCapabilities, { DEFAULT_AUDIO_CAPABILITIES, receiverCapabilities } from './RTCRtpCapabilities';
|
|
3
|
+
import { RTCRtpParametersInit } from './RTCRtpParameters';
|
|
4
|
+
import RTCRtpReceiveParameters from './RTCRtpReceiveParameters';
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
export default class RTCRtpReceiver {
|
|
6
8
|
_id: string;
|
|
7
9
|
_peerConnectionId: number;
|
|
8
|
-
_track: MediaStreamTrack;
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
_track: MediaStreamTrack | null = null;
|
|
11
|
+
_rtpParameters: RTCRtpReceiveParameters;
|
|
12
|
+
|
|
13
|
+
constructor(info: {
|
|
14
|
+
peerConnectionId: number,
|
|
15
|
+
id: string,
|
|
16
|
+
track?: MediaStreamTrack,
|
|
17
|
+
rtpParameters: RTCRtpParametersInit
|
|
18
|
+
}) {
|
|
11
19
|
this._id = info.id;
|
|
12
20
|
this._peerConnectionId = info.peerConnectionId;
|
|
13
|
-
this.
|
|
21
|
+
this._rtpParameters = new RTCRtpReceiveParameters(info.rtpParameters);
|
|
22
|
+
|
|
23
|
+
if (info.track) {
|
|
24
|
+
this._track = info.track;
|
|
25
|
+
}
|
|
14
26
|
}
|
|
15
27
|
|
|
16
28
|
static getCapabilities(kind: 'audio' | 'video'): RTCRtpCapabilities {
|
|
@@ -25,6 +37,10 @@ export default class RTCRtpReceiver {
|
|
|
25
37
|
return receiverCapabilities;
|
|
26
38
|
}
|
|
27
39
|
|
|
40
|
+
getParameters(): RTCRtpReceiveParameters {
|
|
41
|
+
return this._rtpParameters;
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
get id() {
|
|
29
45
|
return this._id;
|
|
30
46
|
}
|