@gjsify/webrtc 0.3.12 → 0.3.14

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.
Files changed (36) hide show
  1. package/lib/esm/get-user-media.js +95 -80
  2. package/lib/esm/gst-enum-maps.js +55 -59
  3. package/lib/esm/gst-init.js +19 -22
  4. package/lib/esm/gst-stats-parser.js +94 -67
  5. package/lib/esm/gst-utils.js +24 -13
  6. package/lib/esm/index.js +13 -43
  7. package/lib/esm/media-device-info.js +23 -22
  8. package/lib/esm/media-devices.js +150 -139
  9. package/lib/esm/media-stream-track.js +136 -139
  10. package/lib/esm/media-stream.js +76 -75
  11. package/lib/esm/register/data-channel.js +7 -3
  12. package/lib/esm/register/error.js +6 -2
  13. package/lib/esm/register/media-devices.js +6 -2
  14. package/lib/esm/register/media.js +8 -4
  15. package/lib/esm/register/peer-connection.js +9 -5
  16. package/lib/esm/rtc-certificate.js +62 -66
  17. package/lib/esm/rtc-data-channel.js +240 -251
  18. package/lib/esm/rtc-dtls-transport.js +40 -39
  19. package/lib/esm/rtc-dtmf-sender.js +92 -100
  20. package/lib/esm/rtc-error.js +24 -22
  21. package/lib/esm/rtc-events.js +33 -33
  22. package/lib/esm/rtc-ice-candidate.js +71 -72
  23. package/lib/esm/rtc-ice-transport.js +95 -94
  24. package/lib/esm/rtc-peer-connection.js +796 -845
  25. package/lib/esm/rtc-rtp-receiver.js +89 -87
  26. package/lib/esm/rtc-rtp-sender.js +282 -290
  27. package/lib/esm/rtc-rtp-transceiver.js +92 -93
  28. package/lib/esm/rtc-sctp-transport.js +38 -38
  29. package/lib/esm/rtc-session-description.js +47 -51
  30. package/lib/esm/rtc-stats-report.js +39 -34
  31. package/lib/esm/rtc-track-event.js +29 -27
  32. package/lib/esm/rtp-capabilities.js +81 -35
  33. package/lib/esm/tee-multiplexer.js +58 -60
  34. package/lib/esm/wpt-helpers.js +128 -112
  35. package/package.json +13 -13
  36. package/tsconfig.tsbuildinfo +1 -1
@@ -1,97 +1,96 @@
1
1
  import { gstDirectionToW3C, w3cDirectionToGst } from "./gst-enum-maps.js";
2
2
  import { RTCRtpSender } from "./rtc-rtp-sender.js";
3
3
  import { RTCRtpReceiver } from "./rtc-rtp-receiver.js";
4
- class RTCRtpTransceiver {
5
- _gstTrans;
6
- sender;
7
- receiver;
8
- _stopped = false;
9
- _codecPreferences = [];
10
- constructor(gstTrans, sender, receiver) {
11
- this._gstTrans = gstTrans;
12
- this.sender = sender;
13
- this.receiver = receiver;
14
- }
15
- get mid() {
16
- if (this._stopped) return null;
17
- const m = this._gstTrans.mid;
18
- return m === "" || m == null ? null : String(m);
19
- }
20
- get direction() {
21
- if (this._stopped) return "stopped";
22
- return gstDirectionToW3C(this._gstTrans.direction);
23
- }
24
- set direction(d) {
25
- if (this._stopped) {
26
- throw new DOMException(
27
- "Cannot set direction on a stopped transceiver",
28
- "InvalidStateError"
29
- );
30
- }
31
- if (d === "stopped") {
32
- throw new TypeError("The provided value 'stopped' is not a valid enum value of type RTCRtpTransceiverDirection.");
33
- }
34
- const valid = ["sendrecv", "sendonly", "recvonly", "inactive"];
35
- if (!valid.includes(d)) {
36
- throw new TypeError(`The provided value '${d}' is not a valid enum value of type RTCRtpTransceiverDirection.`);
37
- }
38
- this._gstTrans.direction = w3cDirectionToGst(d);
39
- }
40
- get currentDirection() {
41
- if (this._stopped) return null;
42
- const cd = this._gstTrans.current_direction ?? this._gstTrans.currentDirection;
43
- if (cd == null) return null;
44
- const w3c = gstDirectionToW3C(cd);
45
- return w3c === "inactive" ? null : w3c;
46
- }
47
- get stopped() {
48
- return this._stopped;
49
- }
50
- stop() {
51
- if (this._stopped) return;
52
- this._stopped = true;
53
- }
54
- setCodecPreferences(codecs) {
55
- if (!Array.isArray(codecs)) {
56
- throw new TypeError("codecs must be an array");
57
- }
58
- if (codecs.length === 0) {
59
- this._codecPreferences = [];
60
- return;
61
- }
62
- const kind = this.receiver.track.kind;
63
- const recvCaps = RTCRtpReceiver.getCapabilities(kind);
64
- const sendCaps = RTCRtpSender.getCapabilities(kind);
65
- if (!recvCaps || !sendCaps) {
66
- throw new DOMException("No capabilities available", "InvalidModificationError");
67
- }
68
- const allCaps = [...recvCaps.codecs, ...sendCaps.codecs];
69
- for (const codec of codecs) {
70
- if (!codec || typeof codec !== "object") {
71
- throw new TypeError("Each codec must be an object");
72
- }
73
- if (typeof codec.mimeType !== "string" || typeof codec.clockRate !== "number") {
74
- throw new TypeError("codec must have mimeType (string) and clockRate (number)");
75
- }
76
- const isResiliency = /\/(rtx|red|ulpfec)$/i.test(codec.mimeType);
77
- if (isResiliency) continue;
78
- const match = allCaps.find(
79
- (c) => c.mimeType.toLowerCase() === codec.mimeType.toLowerCase() && c.clockRate === codec.clockRate && (codec.channels === void 0 || c.channels === codec.channels) && (codec.sdpFmtpLine === void 0 || c.sdpFmtpLine === codec.sdpFmtpLine)
80
- );
81
- if (!match) {
82
- throw new DOMException(
83
- `Codec ${codec.mimeType} ${codec.clockRate} is not in capabilities`,
84
- "InvalidModificationError"
85
- );
86
- }
87
- }
88
- this._codecPreferences = [...codecs];
89
- }
90
- /** @internal */
91
- get _nativeTransceiver() {
92
- return this._gstTrans;
93
- }
94
- }
95
- export {
96
- RTCRtpTransceiver
4
+
5
+ //#region src/rtc-rtp-transceiver.ts
6
+ var RTCRtpTransceiver = class {
7
+ _gstTrans;
8
+ sender;
9
+ receiver;
10
+ _stopped = false;
11
+ _codecPreferences = [];
12
+ constructor(gstTrans, sender, receiver) {
13
+ this._gstTrans = gstTrans;
14
+ this.sender = sender;
15
+ this.receiver = receiver;
16
+ }
17
+ get mid() {
18
+ if (this._stopped) return null;
19
+ const m = this._gstTrans.mid;
20
+ return m === "" || m == null ? null : String(m);
21
+ }
22
+ get direction() {
23
+ if (this._stopped) return "stopped";
24
+ return gstDirectionToW3C(this._gstTrans.direction);
25
+ }
26
+ set direction(d) {
27
+ if (this._stopped) {
28
+ throw new DOMException("Cannot set direction on a stopped transceiver", "InvalidStateError");
29
+ }
30
+ if (d === "stopped") {
31
+ throw new TypeError("The provided value 'stopped' is not a valid enum value of type RTCRtpTransceiverDirection.");
32
+ }
33
+ const valid = [
34
+ "sendrecv",
35
+ "sendonly",
36
+ "recvonly",
37
+ "inactive"
38
+ ];
39
+ if (!valid.includes(d)) {
40
+ throw new TypeError(`The provided value '${d}' is not a valid enum value of type RTCRtpTransceiverDirection.`);
41
+ }
42
+ this._gstTrans.direction = w3cDirectionToGst(d);
43
+ }
44
+ get currentDirection() {
45
+ if (this._stopped) return null;
46
+ const cd = this._gstTrans.current_direction ?? this._gstTrans.currentDirection;
47
+ if (cd == null) return null;
48
+ const w3c = gstDirectionToW3C(cd);
49
+ return w3c === "inactive" ? null : w3c;
50
+ }
51
+ get stopped() {
52
+ return this._stopped;
53
+ }
54
+ stop() {
55
+ if (this._stopped) return;
56
+ this._stopped = true;
57
+ }
58
+ setCodecPreferences(codecs) {
59
+ if (!Array.isArray(codecs)) {
60
+ throw new TypeError("codecs must be an array");
61
+ }
62
+ if (codecs.length === 0) {
63
+ this._codecPreferences = [];
64
+ return;
65
+ }
66
+ const kind = this.receiver.track.kind;
67
+ const recvCaps = RTCRtpReceiver.getCapabilities(kind);
68
+ const sendCaps = RTCRtpSender.getCapabilities(kind);
69
+ if (!recvCaps || !sendCaps) {
70
+ throw new DOMException("No capabilities available", "InvalidModificationError");
71
+ }
72
+ const allCaps = [...recvCaps.codecs, ...sendCaps.codecs];
73
+ for (const codec of codecs) {
74
+ if (!codec || typeof codec !== "object") {
75
+ throw new TypeError("Each codec must be an object");
76
+ }
77
+ if (typeof codec.mimeType !== "string" || typeof codec.clockRate !== "number") {
78
+ throw new TypeError("codec must have mimeType (string) and clockRate (number)");
79
+ }
80
+ const isResiliency = /\/(rtx|red|ulpfec)$/i.test(codec.mimeType);
81
+ if (isResiliency) continue;
82
+ const match = allCaps.find((c) => c.mimeType.toLowerCase() === codec.mimeType.toLowerCase() && c.clockRate === codec.clockRate && (codec.channels === undefined || c.channels === codec.channels) && (codec.sdpFmtpLine === undefined || c.sdpFmtpLine === codec.sdpFmtpLine));
83
+ if (!match) {
84
+ throw new DOMException(`Codec ${codec.mimeType} ${codec.clockRate} is not in capabilities`, "InvalidModificationError");
85
+ }
86
+ }
87
+ this._codecPreferences = [...codecs];
88
+ }
89
+ /** @internal */
90
+ get _nativeTransceiver() {
91
+ return this._gstTrans;
92
+ }
97
93
  };
94
+
95
+ //#endregion
96
+ export { RTCRtpTransceiver };
@@ -1,40 +1,40 @@
1
1
  import "@gjsify/dom-events/register/event-target";
2
- class RTCSctpTransport extends EventTarget {
3
- transport;
4
- _state = "connecting";
5
- _maxMessageSize = 262144;
6
- // 256 KB default per SCTP
7
- _maxChannels = 65535;
8
- _onstatechange = null;
9
- constructor(dtlsTransport) {
10
- super();
11
- this.transport = dtlsTransport;
12
- }
13
- get state() {
14
- return this._state;
15
- }
16
- get maxMessageSize() {
17
- return this._maxMessageSize;
18
- }
19
- get maxChannels() {
20
- return this._maxChannels;
21
- }
22
- get onstatechange() {
23
- return this._onstatechange;
24
- }
25
- set onstatechange(v) {
26
- this._onstatechange = v;
27
- }
28
- // ---- Internal setters (called by RTCPeerConnection) ---------------------
29
- /** @internal */
30
- _setState(state) {
31
- if (this._state === state) return;
32
- this._state = state;
33
- const ev = new Event("statechange");
34
- this._onstatechange?.call(this, ev);
35
- this.dispatchEvent(ev);
36
- }
37
- }
38
- export {
39
- RTCSctpTransport
2
+
3
+ //#region src/rtc-sctp-transport.ts
4
+ var RTCSctpTransport = class extends EventTarget {
5
+ transport;
6
+ _state = "connecting";
7
+ _maxMessageSize = 262144;
8
+ _maxChannels = 65535;
9
+ _onstatechange = null;
10
+ constructor(dtlsTransport) {
11
+ super();
12
+ this.transport = dtlsTransport;
13
+ }
14
+ get state() {
15
+ return this._state;
16
+ }
17
+ get maxMessageSize() {
18
+ return this._maxMessageSize;
19
+ }
20
+ get maxChannels() {
21
+ return this._maxChannels;
22
+ }
23
+ get onstatechange() {
24
+ return this._onstatechange;
25
+ }
26
+ set onstatechange(v) {
27
+ this._onstatechange = v;
28
+ }
29
+ /** @internal */
30
+ _setState(state) {
31
+ if (this._state === state) return;
32
+ this._state = state;
33
+ const ev = new Event("statechange");
34
+ this._onstatechange?.call(this, ev);
35
+ this.dispatchEvent(ev);
36
+ }
40
37
  };
38
+
39
+ //#endregion
40
+ export { RTCSctpTransport };
@@ -1,57 +1,53 @@
1
- import GstSdp from "gi://GstSdp?version=1.0";
2
1
  import GstWebRTC from "gi://GstWebRTC?version=1.0";
2
+ import GstSdp from "gi://GstSdp?version=1.0";
3
+
4
+ //#region src/rtc-session-description.ts
3
5
  function sdpTypeToGst(type) {
4
- switch (type) {
5
- case "offer":
6
- return GstWebRTC.WebRTCSDPType.OFFER;
7
- case "pranswer":
8
- return GstWebRTC.WebRTCSDPType.PRANSWER;
9
- case "answer":
10
- return GstWebRTC.WebRTCSDPType.ANSWER;
11
- case "rollback":
12
- return GstWebRTC.WebRTCSDPType.ROLLBACK;
13
- }
6
+ switch (type) {
7
+ case "offer": return GstWebRTC.WebRTCSDPType.OFFER;
8
+ case "pranswer": return GstWebRTC.WebRTCSDPType.PRANSWER;
9
+ case "answer": return GstWebRTC.WebRTCSDPType.ANSWER;
10
+ case "rollback": return GstWebRTC.WebRTCSDPType.ROLLBACK;
11
+ }
14
12
  }
15
13
  function sdpTypeFromGst(type) {
16
- switch (type) {
17
- case GstWebRTC.WebRTCSDPType.OFFER:
18
- return "offer";
19
- case GstWebRTC.WebRTCSDPType.PRANSWER:
20
- return "pranswer";
21
- case GstWebRTC.WebRTCSDPType.ANSWER:
22
- return "answer";
23
- case GstWebRTC.WebRTCSDPType.ROLLBACK:
24
- return "rollback";
25
- default:
26
- return "offer";
27
- }
28
- }
29
- class RTCSessionDescription {
30
- type;
31
- sdp;
32
- constructor(init) {
33
- this.type = init?.type ?? "offer";
34
- this.sdp = init?.sdp ?? "";
35
- }
36
- toJSON() {
37
- return { type: this.type, sdp: this.sdp };
38
- }
39
- /** Build a GstWebRTC.WebRTCSessionDescription for use with webrtcbin signals. */
40
- toGstDesc() {
41
- const [ret, sdp] = GstSdp.SDPMessage.new_from_text(this.sdp);
42
- if (ret !== GstSdp.SDPResult.OK) {
43
- throw new Error(`Failed to parse SDP text (GstSDPResult=${ret})`);
44
- }
45
- return GstWebRTC.WebRTCSessionDescription.new(sdpTypeToGst(this.type), sdp);
46
- }
47
- static fromGstDesc(desc) {
48
- const sdpText = desc.sdp?.as_text?.() ?? "";
49
- return new RTCSessionDescription({
50
- type: sdpTypeFromGst(desc.type),
51
- sdp: sdpText
52
- });
53
- }
14
+ switch (type) {
15
+ case GstWebRTC.WebRTCSDPType.OFFER: return "offer";
16
+ case GstWebRTC.WebRTCSDPType.PRANSWER: return "pranswer";
17
+ case GstWebRTC.WebRTCSDPType.ANSWER: return "answer";
18
+ case GstWebRTC.WebRTCSDPType.ROLLBACK: return "rollback";
19
+ default: return "offer";
20
+ }
54
21
  }
55
- export {
56
- RTCSessionDescription
22
+ var RTCSessionDescription = class RTCSessionDescription {
23
+ type;
24
+ sdp;
25
+ constructor(init) {
26
+ this.type = init?.type ?? "offer";
27
+ this.sdp = init?.sdp ?? "";
28
+ }
29
+ toJSON() {
30
+ return {
31
+ type: this.type,
32
+ sdp: this.sdp
33
+ };
34
+ }
35
+ /** Build a GstWebRTC.WebRTCSessionDescription for use with webrtcbin signals. */
36
+ toGstDesc() {
37
+ const [ret, sdp] = GstSdp.SDPMessage.new_from_text(this.sdp);
38
+ if (ret !== GstSdp.SDPResult.OK) {
39
+ throw new Error(`Failed to parse SDP text (GstSDPResult=${ret})`);
40
+ }
41
+ return GstWebRTC.WebRTCSessionDescription.new(sdpTypeToGst(this.type), sdp);
42
+ }
43
+ static fromGstDesc(desc) {
44
+ const sdpText = desc.sdp?.as_text?.() ?? "";
45
+ return new RTCSessionDescription({
46
+ type: sdpTypeFromGst(desc.type),
47
+ sdp: sdpText
48
+ });
49
+ }
57
50
  };
51
+
52
+ //#endregion
53
+ export { RTCSessionDescription };
@@ -1,35 +1,40 @@
1
- class RTCStatsReport {
2
- _map;
3
- constructor(entries) {
4
- this._map = new Map(entries);
5
- }
6
- get size() {
7
- return this._map.size;
8
- }
9
- get(key) {
10
- return this._map.get(key);
11
- }
12
- has(key) {
13
- return this._map.has(key);
14
- }
15
- forEach(callbackfn, thisArg) {
16
- this._map.forEach((value, key) => {
17
- callbackfn.call(thisArg, value, key, this);
18
- });
19
- }
20
- entries() {
21
- return this._map.entries();
22
- }
23
- keys() {
24
- return this._map.keys();
25
- }
26
- values() {
27
- return this._map.values();
28
- }
29
- [Symbol.iterator]() {
30
- return this._map.entries();
31
- }
32
- }
33
- export {
34
- RTCStatsReport
1
+ //#region src/rtc-stats-report.ts
2
+ /**
3
+ * Read-only Map-like collection of stats entries keyed by id.
4
+ * W3C requires iteration support but not mutation.
5
+ */
6
+ var RTCStatsReport = class {
7
+ _map;
8
+ constructor(entries) {
9
+ this._map = new Map(entries);
10
+ }
11
+ get size() {
12
+ return this._map.size;
13
+ }
14
+ get(key) {
15
+ return this._map.get(key);
16
+ }
17
+ has(key) {
18
+ return this._map.has(key);
19
+ }
20
+ forEach(callbackfn, thisArg) {
21
+ this._map.forEach((value, key) => {
22
+ callbackfn.call(thisArg, value, key, this);
23
+ });
24
+ }
25
+ entries() {
26
+ return this._map.entries();
27
+ }
28
+ keys() {
29
+ return this._map.keys();
30
+ }
31
+ values() {
32
+ return this._map.values();
33
+ }
34
+ [Symbol.iterator]() {
35
+ return this._map.entries();
36
+ }
35
37
  };
38
+
39
+ //#endregion
40
+ export { RTCStatsReport };
@@ -1,29 +1,31 @@
1
1
  import "@gjsify/dom-events/register/event-target";
2
- class RTCTrackEvent extends Event {
3
- receiver;
4
- track;
5
- streams;
6
- transceiver;
7
- constructor(type, init) {
8
- super(type, init);
9
- if (!init || typeof init !== "object") {
10
- throw new TypeError("RTCTrackEventInit is required");
11
- }
12
- if (!("receiver" in init)) {
13
- throw new TypeError("Failed to construct 'RTCTrackEvent': required member receiver is not provided.");
14
- }
15
- if (!("track" in init)) {
16
- throw new TypeError("Failed to construct 'RTCTrackEvent': required member track is not provided.");
17
- }
18
- if (!("transceiver" in init)) {
19
- throw new TypeError("Failed to construct 'RTCTrackEvent': required member transceiver is not provided.");
20
- }
21
- this.receiver = init.receiver;
22
- this.track = init.track;
23
- this.streams = Object.freeze(init.streams ? [...init.streams] : []);
24
- this.transceiver = init.transceiver;
25
- }
26
- }
27
- export {
28
- RTCTrackEvent
2
+
3
+ //#region src/rtc-track-event.ts
4
+ var RTCTrackEvent = class extends Event {
5
+ receiver;
6
+ track;
7
+ streams;
8
+ transceiver;
9
+ constructor(type, init) {
10
+ super(type, init);
11
+ if (!init || typeof init !== "object") {
12
+ throw new TypeError("RTCTrackEventInit is required");
13
+ }
14
+ if (!("receiver" in init)) {
15
+ throw new TypeError("Failed to construct 'RTCTrackEvent': required member receiver is not provided.");
16
+ }
17
+ if (!("track" in init)) {
18
+ throw new TypeError("Failed to construct 'RTCTrackEvent': required member track is not provided.");
19
+ }
20
+ if (!("transceiver" in init)) {
21
+ throw new TypeError("Failed to construct 'RTCTrackEvent': required member transceiver is not provided.");
22
+ }
23
+ this.receiver = init.receiver;
24
+ this.track = init.track;
25
+ this.streams = Object.freeze(init.streams ? [...init.streams] : []);
26
+ this.transceiver = init.transceiver;
27
+ }
29
28
  };
29
+
30
+ //#endregion
31
+ export { RTCTrackEvent };
@@ -1,41 +1,87 @@
1
+ //#region src/rtp-capabilities.ts
1
2
  const AUDIO_CAPABILITIES = {
2
- codecs: [
3
- { mimeType: "audio/opus", clockRate: 48e3, channels: 2, sdpFmtpLine: "minptime=10;useinbandfec=1" },
4
- { mimeType: "audio/G722", clockRate: 8e3, channels: 1 },
5
- { mimeType: "audio/PCMU", clockRate: 8e3, channels: 1 },
6
- { mimeType: "audio/PCMA", clockRate: 8e3, channels: 1 },
7
- { mimeType: "audio/telephone-event", clockRate: 8e3, channels: 1 },
8
- { mimeType: "audio/red", clockRate: 48e3, channels: 2 }
9
- ],
10
- headerExtensions: [
11
- { uri: "urn:ietf:params:rtp-hdrext:ssrc-audio-level" },
12
- { uri: "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time" },
13
- { uri: "urn:ietf:params:rtp-hdrext:sdes:mid" }
14
- ]
3
+ codecs: [
4
+ {
5
+ mimeType: "audio/opus",
6
+ clockRate: 48e3,
7
+ channels: 2,
8
+ sdpFmtpLine: "minptime=10;useinbandfec=1"
9
+ },
10
+ {
11
+ mimeType: "audio/G722",
12
+ clockRate: 8e3,
13
+ channels: 1
14
+ },
15
+ {
16
+ mimeType: "audio/PCMU",
17
+ clockRate: 8e3,
18
+ channels: 1
19
+ },
20
+ {
21
+ mimeType: "audio/PCMA",
22
+ clockRate: 8e3,
23
+ channels: 1
24
+ },
25
+ {
26
+ mimeType: "audio/telephone-event",
27
+ clockRate: 8e3,
28
+ channels: 1
29
+ },
30
+ {
31
+ mimeType: "audio/red",
32
+ clockRate: 48e3,
33
+ channels: 2
34
+ }
35
+ ],
36
+ headerExtensions: [
37
+ { uri: "urn:ietf:params:rtp-hdrext:ssrc-audio-level" },
38
+ { uri: "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time" },
39
+ { uri: "urn:ietf:params:rtp-hdrext:sdes:mid" }
40
+ ]
15
41
  };
16
42
  const VIDEO_CAPABILITIES = {
17
- codecs: [
18
- { mimeType: "video/VP8", clockRate: 9e4 },
19
- { mimeType: "video/rtx", clockRate: 9e4 },
20
- { mimeType: "video/H264", clockRate: 9e4, sdpFmtpLine: "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f" },
21
- { mimeType: "video/VP9", clockRate: 9e4 },
22
- { mimeType: "video/red", clockRate: 9e4 },
23
- { mimeType: "video/ulpfec", clockRate: 9e4 }
24
- ],
25
- headerExtensions: [
26
- { uri: "urn:ietf:params:rtp-hdrext:toffset" },
27
- { uri: "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time" },
28
- { uri: "urn:3gpp:video-orientation" },
29
- { uri: "urn:ietf:params:rtp-hdrext:sdes:mid" },
30
- { uri: "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id" },
31
- { uri: "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id" }
32
- ]
43
+ codecs: [
44
+ {
45
+ mimeType: "video/VP8",
46
+ clockRate: 9e4
47
+ },
48
+ {
49
+ mimeType: "video/rtx",
50
+ clockRate: 9e4
51
+ },
52
+ {
53
+ mimeType: "video/H264",
54
+ clockRate: 9e4,
55
+ sdpFmtpLine: "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"
56
+ },
57
+ {
58
+ mimeType: "video/VP9",
59
+ clockRate: 9e4
60
+ },
61
+ {
62
+ mimeType: "video/red",
63
+ clockRate: 9e4
64
+ },
65
+ {
66
+ mimeType: "video/ulpfec",
67
+ clockRate: 9e4
68
+ }
69
+ ],
70
+ headerExtensions: [
71
+ { uri: "urn:ietf:params:rtp-hdrext:toffset" },
72
+ { uri: "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time" },
73
+ { uri: "urn:3gpp:video-orientation" },
74
+ { uri: "urn:ietf:params:rtp-hdrext:sdes:mid" },
75
+ { uri: "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id" },
76
+ { uri: "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id" }
77
+ ]
33
78
  };
79
+ /** Shared implementation for RTCRtpSender.getCapabilities / RTCRtpReceiver.getCapabilities. */
34
80
  function getRtpCapabilities(kind) {
35
- if (kind === "audio") return AUDIO_CAPABILITIES;
36
- if (kind === "video") return VIDEO_CAPABILITIES;
37
- return null;
81
+ if (kind === "audio") return AUDIO_CAPABILITIES;
82
+ if (kind === "video") return VIDEO_CAPABILITIES;
83
+ return null;
38
84
  }
39
- export {
40
- getRtpCapabilities
41
- };
85
+
86
+ //#endregion
87
+ export { getRtpCapabilities };