mediasoup-client 3.6.90 → 3.6.92
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/lib/Consumer.d.ts +115 -0
- package/lib/Consumer.d.ts.map +1 -0
- package/lib/Consumer.js +190 -0
- package/lib/DataConsumer.d.ts +93 -0
- package/lib/DataConsumer.d.ts.map +1 -0
- package/lib/DataConsumer.js +162 -0
- package/lib/DataProducer.d.ts +97 -0
- package/lib/DataProducer.d.ts.map +1 -0
- package/lib/DataProducer.js +180 -0
- package/lib/Device.d.ts +92 -0
- package/lib/Device.d.ts.map +1 -0
- package/lib/Device.js +464 -0
- package/lib/EnhancedEventEmitter.d.ts +24 -0
- package/lib/EnhancedEventEmitter.d.ts.map +1 -0
- package/lib/EnhancedEventEmitter.js +70 -0
- package/lib/Logger.d.ts +11 -0
- package/lib/Logger.d.ts.map +1 -0
- package/lib/Logger.js +37 -0
- package/lib/Producer.d.ts +169 -0
- package/lib/Producer.d.ts.map +1 -0
- package/lib/Producer.js +287 -0
- package/lib/RtpParameters.d.ts +306 -0
- package/lib/RtpParameters.d.ts.map +1 -0
- package/lib/RtpParameters.js +6 -0
- package/lib/SctpParameters.d.ts +68 -0
- package/lib/SctpParameters.d.ts.map +1 -0
- package/lib/SctpParameters.js +2 -0
- package/lib/Transport.d.ts +243 -0
- package/lib/Transport.d.ts.map +1 -0
- package/lib/Transport.js +824 -0
- package/lib/errors.d.ts +13 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +39 -0
- package/lib/handlers/Chrome111.d.ts +49 -0
- package/lib/handlers/Chrome111.d.ts.map +1 -0
- package/lib/handlers/Chrome111.js +658 -0
- package/lib/handlers/Chrome55.d.ts +51 -0
- package/lib/handlers/Chrome55.d.ts.map +1 -0
- package/lib/handlers/Chrome55.js +542 -0
- package/lib/handlers/Chrome67.d.ts +51 -0
- package/lib/handlers/Chrome67.d.ts.map +1 -0
- package/lib/handlers/Chrome67.js +598 -0
- package/lib/handlers/Chrome70.d.ts +49 -0
- package/lib/handlers/Chrome70.d.ts.map +1 -0
- package/lib/handlers/Chrome70.js +627 -0
- package/lib/handlers/Chrome74.d.ts +49 -0
- package/lib/handlers/Chrome74.d.ts.map +1 -0
- package/lib/handlers/Chrome74.js +675 -0
- package/lib/handlers/Edge11.d.ts +55 -0
- package/lib/handlers/Edge11.d.ts.map +1 -0
- package/lib/handlers/Edge11.js +447 -0
- package/lib/handlers/FakeHandler.d.ts +49 -0
- package/lib/handlers/FakeHandler.d.ts.map +1 -0
- package/lib/handlers/FakeHandler.js +276 -0
- package/lib/handlers/Firefox60.d.ts +48 -0
- package/lib/handlers/Firefox60.d.ts.map +1 -0
- package/lib/handlers/Firefox60.js +681 -0
- package/lib/handlers/HandlerInterface.d.ts +97 -0
- package/lib/handlers/HandlerInterface.d.ts.map +1 -0
- package/lib/handlers/HandlerInterface.js +10 -0
- package/lib/handlers/ReactNative.d.ts +51 -0
- package/lib/handlers/ReactNative.d.ts.map +1 -0
- package/lib/handlers/ReactNative.js +558 -0
- package/lib/handlers/ReactNativeUnifiedPlan.d.ts +49 -0
- package/lib/handlers/ReactNativeUnifiedPlan.d.ts.map +1 -0
- package/lib/handlers/ReactNativeUnifiedPlan.js +697 -0
- package/lib/handlers/Safari11.d.ts +51 -0
- package/lib/handlers/Safari11.d.ts.map +1 -0
- package/lib/handlers/Safari11.js +592 -0
- package/lib/handlers/Safari12.d.ts +49 -0
- package/lib/handlers/Safari12.d.ts.map +1 -0
- package/lib/handlers/Safari12.js +648 -0
- package/lib/handlers/ortc/edgeUtils.d.ts +11 -0
- package/lib/handlers/ortc/edgeUtils.d.ts.map +1 -0
- package/lib/handlers/ortc/edgeUtils.js +86 -0
- package/lib/handlers/ortc/utils.d.ts +6 -0
- package/lib/handlers/ortc/utils.d.ts.map +1 -0
- package/lib/handlers/ortc/utils.js +20 -0
- package/lib/handlers/sdp/MediaSection.d.ts +68 -0
- package/lib/handlers/sdp/MediaSection.d.ts.map +1 -0
- package/lib/handlers/sdp/MediaSection.js +589 -0
- package/lib/handlers/sdp/RemoteSdp.d.ts +75 -0
- package/lib/handlers/sdp/RemoteSdp.d.ts.map +1 -0
- package/lib/handlers/sdp/RemoteSdp.js +303 -0
- package/lib/handlers/sdp/commonUtils.d.ts +24 -0
- package/lib/handlers/sdp/commonUtils.d.ts.map +1 -0
- package/lib/handlers/sdp/commonUtils.js +224 -0
- package/lib/handlers/sdp/plainRtpUtils.d.ts +14 -0
- package/lib/handlers/sdp/plainRtpUtils.d.ts.map +1 -0
- package/lib/handlers/sdp/plainRtpUtils.js +33 -0
- package/lib/handlers/sdp/planBUtils.d.ts +14 -0
- package/lib/handlers/sdp/planBUtils.d.ts.map +1 -0
- package/lib/handlers/sdp/planBUtils.js +155 -0
- package/lib/handlers/sdp/unifiedPlanUtils.d.ts +12 -0
- package/lib/handlers/sdp/unifiedPlanUtils.d.ts.map +1 -0
- package/lib/handlers/sdp/unifiedPlanUtils.js +131 -0
- package/lib/index.d.ts +14 -1435
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +43 -11884
- package/lib/ortc.d.ts +123 -0
- package/lib/ortc.d.ts.map +1 -0
- package/lib/ortc.js +943 -0
- package/lib/scalabilityModes.d.ts +6 -0
- package/lib/scalabilityModes.d.ts.map +1 -0
- package/lib/scalabilityModes.js +20 -0
- package/lib/tests/fakeParameters.d.ts +20 -0
- package/lib/tests/fakeParameters.d.ts.map +1 -0
- package/lib/tests/fakeParameters.js +659 -0
- package/lib/tests/test.d.ts +6 -0
- package/lib/tests/test.d.ts.map +1 -0
- package/lib/tests/test.js +1297 -0
- package/lib/tests/uaTestCases.d.ts +9 -0
- package/lib/tests/uaTestCases.d.ts.map +1 -0
- package/lib/tests/uaTestCases.js +85 -0
- package/lib/types.d.ts +15 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +26 -0
- package/lib/utils.d.ts +9 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +20 -0
- package/npm-scripts.mjs +2 -3
- package/package.json +4 -9
- package/lib/index.js.map +0 -1
- package/lib/index.mjs +0 -11860
- package/lib/index.mjs.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { HandlerFactory, HandlerInterface, HandlerRunOptions, HandlerSendOptions, HandlerSendResult, HandlerReceiveOptions, HandlerReceiveResult, HandlerSendDataChannelOptions, HandlerSendDataChannelResult, HandlerReceiveDataChannelOptions, HandlerReceiveDataChannelResult } from './HandlerInterface';
|
|
2
|
+
import { IceParameters } from '../Transport';
|
|
3
|
+
import { RtpCapabilities } from '../RtpParameters';
|
|
4
|
+
import { SctpCapabilities } from '../SctpParameters';
|
|
5
|
+
export declare class Chrome55 extends HandlerInterface {
|
|
6
|
+
private _direction?;
|
|
7
|
+
private _remoteSdp?;
|
|
8
|
+
private _sendingRtpParametersByKind?;
|
|
9
|
+
private _sendingRemoteRtpParametersByKind?;
|
|
10
|
+
private _forcedLocalDtlsRole?;
|
|
11
|
+
private _pc;
|
|
12
|
+
private readonly _sendStream;
|
|
13
|
+
private readonly _mapSendLocalIdTrack;
|
|
14
|
+
private _nextSendLocalId;
|
|
15
|
+
private readonly _mapRecvLocalIdInfo;
|
|
16
|
+
private _hasDataChannelMediaSection;
|
|
17
|
+
private _nextSendSctpStreamId;
|
|
18
|
+
private _transportReady;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a factory function.
|
|
21
|
+
*/
|
|
22
|
+
static createFactory(): HandlerFactory;
|
|
23
|
+
constructor();
|
|
24
|
+
get name(): string;
|
|
25
|
+
close(): void;
|
|
26
|
+
getNativeRtpCapabilities(): Promise<RtpCapabilities>;
|
|
27
|
+
getNativeSctpCapabilities(): Promise<SctpCapabilities>;
|
|
28
|
+
run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }: HandlerRunOptions): void;
|
|
29
|
+
updateIceServers(iceServers: RTCIceServer[]): Promise<void>;
|
|
30
|
+
restartIce(iceParameters: IceParameters): Promise<void>;
|
|
31
|
+
getTransportStats(): Promise<RTCStatsReport>;
|
|
32
|
+
send({ track, encodings, codecOptions, codec }: HandlerSendOptions): Promise<HandlerSendResult>;
|
|
33
|
+
stopSending(localId: string): Promise<void>;
|
|
34
|
+
pauseSending(localId: string): Promise<void>;
|
|
35
|
+
resumeSending(localId: string): Promise<void>;
|
|
36
|
+
replaceTrack(localId: string, track: MediaStreamTrack | null): Promise<void>;
|
|
37
|
+
setMaxSpatialLayer(localId: string, spatialLayer: number): Promise<void>;
|
|
38
|
+
setRtpEncodingParameters(localId: string, params: any): Promise<void>;
|
|
39
|
+
getSenderStats(localId: string): Promise<RTCStatsReport>;
|
|
40
|
+
sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }: HandlerSendDataChannelOptions): Promise<HandlerSendDataChannelResult>;
|
|
41
|
+
receive(optionsList: HandlerReceiveOptions[]): Promise<HandlerReceiveResult[]>;
|
|
42
|
+
stopReceiving(localIds: string[]): Promise<void>;
|
|
43
|
+
pauseReceiving(localIds: string[]): Promise<void>;
|
|
44
|
+
resumeReceiving(localIds: string[]): Promise<void>;
|
|
45
|
+
getReceiverStats(localId: string): Promise<RTCStatsReport>;
|
|
46
|
+
receiveDataChannel({ sctpStreamParameters, label, protocol }: HandlerReceiveDataChannelOptions): Promise<HandlerReceiveDataChannelResult>;
|
|
47
|
+
private setupTransport;
|
|
48
|
+
private assertSendDirection;
|
|
49
|
+
private assertRecvDirection;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=Chrome55.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chrome55.d.ts","sourceRoot":"","sources":["../../src/handlers/Chrome55.ts"],"names":[],"mappings":"AAOA,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,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7B,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAK1D,kBAAkB,CACvB,EAAE,oBAAoB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gCAAgC,GACzE,OAAO,CAAC,+BAA+B,CAAC;YAiE7B,cAAc;IAyC5B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,mBAAmB;CAQ3B"}
|
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Chrome55 = void 0;
|
|
27
|
+
const sdpTransform = __importStar(require("sdp-transform"));
|
|
28
|
+
const Logger_1 = require("../Logger");
|
|
29
|
+
const errors_1 = require("../errors");
|
|
30
|
+
const utils = __importStar(require("../utils"));
|
|
31
|
+
const ortc = __importStar(require("../ortc"));
|
|
32
|
+
const sdpCommonUtils = __importStar(require("./sdp/commonUtils"));
|
|
33
|
+
const sdpPlanBUtils = __importStar(require("./sdp/planBUtils"));
|
|
34
|
+
const HandlerInterface_1 = require("./HandlerInterface");
|
|
35
|
+
const RemoteSdp_1 = require("./sdp/RemoteSdp");
|
|
36
|
+
const logger = new Logger_1.Logger('Chrome55');
|
|
37
|
+
const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 };
|
|
38
|
+
class Chrome55 extends HandlerInterface_1.HandlerInterface {
|
|
39
|
+
/**
|
|
40
|
+
* Creates a factory function.
|
|
41
|
+
*/
|
|
42
|
+
static createFactory() {
|
|
43
|
+
return () => new Chrome55();
|
|
44
|
+
}
|
|
45
|
+
constructor() {
|
|
46
|
+
super();
|
|
47
|
+
// Local stream for sending.
|
|
48
|
+
this._sendStream = new MediaStream();
|
|
49
|
+
// Map of sending MediaStreamTracks indexed by localId.
|
|
50
|
+
this._mapSendLocalIdTrack = new Map();
|
|
51
|
+
// Next sending localId.
|
|
52
|
+
this._nextSendLocalId = 0;
|
|
53
|
+
// Map of MID, RTP parameters and RTCRtpReceiver indexed by local id.
|
|
54
|
+
// Value is an Object with mid, rtpParameters and rtpReceiver.
|
|
55
|
+
this._mapRecvLocalIdInfo = new Map();
|
|
56
|
+
// Whether a DataChannel m=application section has been created.
|
|
57
|
+
this._hasDataChannelMediaSection = false;
|
|
58
|
+
// Sending DataChannel id value counter. Incremented for each new DataChannel.
|
|
59
|
+
this._nextSendSctpStreamId = 0;
|
|
60
|
+
// Got transport local and remote parameters.
|
|
61
|
+
this._transportReady = false;
|
|
62
|
+
}
|
|
63
|
+
get name() {
|
|
64
|
+
return 'Chrome55';
|
|
65
|
+
}
|
|
66
|
+
close() {
|
|
67
|
+
logger.debug('close()');
|
|
68
|
+
// Close RTCPeerConnection.
|
|
69
|
+
if (this._pc) {
|
|
70
|
+
try {
|
|
71
|
+
this._pc.close();
|
|
72
|
+
}
|
|
73
|
+
catch (error) { }
|
|
74
|
+
}
|
|
75
|
+
this.emit('@close');
|
|
76
|
+
}
|
|
77
|
+
async getNativeRtpCapabilities() {
|
|
78
|
+
logger.debug('getNativeRtpCapabilities()');
|
|
79
|
+
const pc = new RTCPeerConnection({
|
|
80
|
+
iceServers: [],
|
|
81
|
+
iceTransportPolicy: 'all',
|
|
82
|
+
bundlePolicy: 'max-bundle',
|
|
83
|
+
rtcpMuxPolicy: 'require',
|
|
84
|
+
sdpSemantics: 'plan-b'
|
|
85
|
+
});
|
|
86
|
+
try {
|
|
87
|
+
const offer = await pc.createOffer({
|
|
88
|
+
offerToReceiveAudio: true,
|
|
89
|
+
offerToReceiveVideo: true
|
|
90
|
+
});
|
|
91
|
+
try {
|
|
92
|
+
pc.close();
|
|
93
|
+
}
|
|
94
|
+
catch (error) { }
|
|
95
|
+
const sdpObject = sdpTransform.parse(offer.sdp);
|
|
96
|
+
const nativeRtpCapabilities = sdpCommonUtils.extractRtpCapabilities({ sdpObject });
|
|
97
|
+
return nativeRtpCapabilities;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
try {
|
|
101
|
+
pc.close();
|
|
102
|
+
}
|
|
103
|
+
catch (error2) { }
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async getNativeSctpCapabilities() {
|
|
108
|
+
logger.debug('getNativeSctpCapabilities()');
|
|
109
|
+
return {
|
|
110
|
+
numStreams: SCTP_NUM_STREAMS
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
|
|
114
|
+
logger.debug('run()');
|
|
115
|
+
this._direction = direction;
|
|
116
|
+
this._remoteSdp = new RemoteSdp_1.RemoteSdp({
|
|
117
|
+
iceParameters,
|
|
118
|
+
iceCandidates,
|
|
119
|
+
dtlsParameters,
|
|
120
|
+
sctpParameters,
|
|
121
|
+
planB: true
|
|
122
|
+
});
|
|
123
|
+
this._sendingRtpParametersByKind =
|
|
124
|
+
{
|
|
125
|
+
audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
|
|
126
|
+
video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
|
|
127
|
+
};
|
|
128
|
+
this._sendingRemoteRtpParametersByKind =
|
|
129
|
+
{
|
|
130
|
+
audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
|
|
131
|
+
video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
|
|
132
|
+
};
|
|
133
|
+
if (dtlsParameters.role && dtlsParameters.role !== 'auto') {
|
|
134
|
+
this._forcedLocalDtlsRole = dtlsParameters.role === 'server'
|
|
135
|
+
? 'client'
|
|
136
|
+
: 'server';
|
|
137
|
+
}
|
|
138
|
+
this._pc = new RTCPeerConnection({
|
|
139
|
+
iceServers: iceServers || [],
|
|
140
|
+
iceTransportPolicy: iceTransportPolicy || 'all',
|
|
141
|
+
bundlePolicy: 'max-bundle',
|
|
142
|
+
rtcpMuxPolicy: 'require',
|
|
143
|
+
sdpSemantics: 'plan-b',
|
|
144
|
+
...additionalSettings
|
|
145
|
+
}, proprietaryConstraints);
|
|
146
|
+
if (this._pc.connectionState) {
|
|
147
|
+
this._pc.addEventListener('connectionstatechange', () => {
|
|
148
|
+
this.emit('@connectionstatechange', this._pc.connectionState);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this._pc.addEventListener('iceconnectionstatechange', () => {
|
|
153
|
+
logger.warn('run() | pc.connectionState not supported, using pc.iceConnectionState');
|
|
154
|
+
switch (this._pc.iceConnectionState) {
|
|
155
|
+
case 'checking':
|
|
156
|
+
this.emit('@connectionstatechange', 'connecting');
|
|
157
|
+
break;
|
|
158
|
+
case 'connected':
|
|
159
|
+
case 'completed':
|
|
160
|
+
this.emit('@connectionstatechange', 'connected');
|
|
161
|
+
break;
|
|
162
|
+
case 'failed':
|
|
163
|
+
this.emit('@connectionstatechange', 'failed');
|
|
164
|
+
break;
|
|
165
|
+
case 'disconnected':
|
|
166
|
+
this.emit('@connectionstatechange', 'disconnected');
|
|
167
|
+
break;
|
|
168
|
+
case 'closed':
|
|
169
|
+
this.emit('@connectionstatechange', 'closed');
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async updateIceServers(iceServers) {
|
|
176
|
+
logger.debug('updateIceServers()');
|
|
177
|
+
const configuration = this._pc.getConfiguration();
|
|
178
|
+
configuration.iceServers = iceServers;
|
|
179
|
+
this._pc.setConfiguration(configuration);
|
|
180
|
+
}
|
|
181
|
+
async restartIce(iceParameters) {
|
|
182
|
+
logger.debug('restartIce()');
|
|
183
|
+
// Provide the remote SDP handler with new remote ICE parameters.
|
|
184
|
+
this._remoteSdp.updateIceParameters(iceParameters);
|
|
185
|
+
if (!this._transportReady) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (this._direction === 'send') {
|
|
189
|
+
const offer = await this._pc.createOffer({ iceRestart: true });
|
|
190
|
+
logger.debug('restartIce() | calling pc.setLocalDescription() [offer:%o]', offer);
|
|
191
|
+
await this._pc.setLocalDescription(offer);
|
|
192
|
+
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
|
|
193
|
+
logger.debug('restartIce() | calling pc.setRemoteDescription() [answer:%o]', answer);
|
|
194
|
+
await this._pc.setRemoteDescription(answer);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
|
|
198
|
+
logger.debug('restartIce() | calling pc.setRemoteDescription() [offer:%o]', offer);
|
|
199
|
+
await this._pc.setRemoteDescription(offer);
|
|
200
|
+
const answer = await this._pc.createAnswer();
|
|
201
|
+
logger.debug('restartIce() | calling pc.setLocalDescription() [answer:%o]', answer);
|
|
202
|
+
await this._pc.setLocalDescription(answer);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
async getTransportStats() {
|
|
206
|
+
return this._pc.getStats();
|
|
207
|
+
}
|
|
208
|
+
async send({ track, encodings, codecOptions, codec }) {
|
|
209
|
+
var _a;
|
|
210
|
+
this.assertSendDirection();
|
|
211
|
+
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
212
|
+
if (codec) {
|
|
213
|
+
logger.warn('send() | codec selection is not available in %s handler', this.name);
|
|
214
|
+
}
|
|
215
|
+
this._sendStream.addTrack(track);
|
|
216
|
+
this._pc.addStream(this._sendStream);
|
|
217
|
+
let offer = await this._pc.createOffer();
|
|
218
|
+
let localSdpObject = sdpTransform.parse(offer.sdp);
|
|
219
|
+
let offerMediaObject;
|
|
220
|
+
const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
|
|
221
|
+
sendingRtpParameters.codecs =
|
|
222
|
+
ortc.reduceCodecs(sendingRtpParameters.codecs);
|
|
223
|
+
const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
|
|
224
|
+
sendingRemoteRtpParameters.codecs =
|
|
225
|
+
ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
|
|
226
|
+
if (!this._transportReady) {
|
|
227
|
+
await this.setupTransport({
|
|
228
|
+
localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
|
|
229
|
+
localSdpObject
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
if (track.kind === 'video' && encodings && encodings.length > 1) {
|
|
233
|
+
logger.debug('send() | enabling simulcast');
|
|
234
|
+
localSdpObject = sdpTransform.parse(offer.sdp);
|
|
235
|
+
offerMediaObject = localSdpObject.media.find((m) => m.type === 'video');
|
|
236
|
+
sdpPlanBUtils.addLegacySimulcast({
|
|
237
|
+
offerMediaObject,
|
|
238
|
+
track,
|
|
239
|
+
numStreams: encodings.length
|
|
240
|
+
});
|
|
241
|
+
offer = { type: 'offer', sdp: sdpTransform.write(localSdpObject) };
|
|
242
|
+
}
|
|
243
|
+
logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer);
|
|
244
|
+
await this._pc.setLocalDescription(offer);
|
|
245
|
+
localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
|
|
246
|
+
offerMediaObject = localSdpObject.media
|
|
247
|
+
.find((m) => m.type === track.kind);
|
|
248
|
+
// Set RTCP CNAME.
|
|
249
|
+
sendingRtpParameters.rtcp.cname =
|
|
250
|
+
sdpCommonUtils.getCname({ offerMediaObject });
|
|
251
|
+
// Set RTP encodings.
|
|
252
|
+
sendingRtpParameters.encodings =
|
|
253
|
+
sdpPlanBUtils.getRtpEncodings({ offerMediaObject, track });
|
|
254
|
+
// Complete encodings with given values.
|
|
255
|
+
if (encodings) {
|
|
256
|
+
for (let idx = 0; idx < sendingRtpParameters.encodings.length; ++idx) {
|
|
257
|
+
if (encodings[idx]) {
|
|
258
|
+
Object.assign(sendingRtpParameters.encodings[idx], encodings[idx]);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// If VP8 and there is effective simulcast, add scalabilityMode to each
|
|
263
|
+
// encoding.
|
|
264
|
+
if (sendingRtpParameters.encodings.length > 1 &&
|
|
265
|
+
sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp8') {
|
|
266
|
+
for (const encoding of sendingRtpParameters.encodings) {
|
|
267
|
+
encoding.scalabilityMode = 'L1T3';
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
this._remoteSdp.send({
|
|
271
|
+
offerMediaObject,
|
|
272
|
+
offerRtpParameters: sendingRtpParameters,
|
|
273
|
+
answerRtpParameters: sendingRemoteRtpParameters,
|
|
274
|
+
codecOptions
|
|
275
|
+
});
|
|
276
|
+
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
|
|
277
|
+
logger.debug('send() | calling pc.setRemoteDescription() [answer:%o]', answer);
|
|
278
|
+
await this._pc.setRemoteDescription(answer);
|
|
279
|
+
const localId = String(this._nextSendLocalId);
|
|
280
|
+
this._nextSendLocalId++;
|
|
281
|
+
// Insert into the map.
|
|
282
|
+
this._mapSendLocalIdTrack.set(localId, track);
|
|
283
|
+
return {
|
|
284
|
+
localId: localId,
|
|
285
|
+
rtpParameters: sendingRtpParameters
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
async stopSending(localId) {
|
|
289
|
+
this.assertSendDirection();
|
|
290
|
+
logger.debug('stopSending() [localId:%s]', localId);
|
|
291
|
+
const track = this._mapSendLocalIdTrack.get(localId);
|
|
292
|
+
if (!track) {
|
|
293
|
+
throw new Error('track not found');
|
|
294
|
+
}
|
|
295
|
+
this._mapSendLocalIdTrack.delete(localId);
|
|
296
|
+
this._sendStream.removeTrack(track);
|
|
297
|
+
this._pc.addStream(this._sendStream);
|
|
298
|
+
const offer = await this._pc.createOffer();
|
|
299
|
+
logger.debug('stopSending() | calling pc.setLocalDescription() [offer:%o]', offer);
|
|
300
|
+
try {
|
|
301
|
+
await this._pc.setLocalDescription(offer);
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
// NOTE: If there are no sending tracks, setLocalDescription() will fail with
|
|
305
|
+
// "Failed to create channels". If so, ignore it.
|
|
306
|
+
if (this._sendStream.getTracks().length === 0) {
|
|
307
|
+
logger.warn('stopSending() | ignoring expected error due no sending tracks: %s', error.toString());
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
throw error;
|
|
311
|
+
}
|
|
312
|
+
if (this._pc.signalingState === 'stable') {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
|
|
316
|
+
logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
|
|
317
|
+
await this._pc.setRemoteDescription(answer);
|
|
318
|
+
}
|
|
319
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
320
|
+
async pauseSending(localId) {
|
|
321
|
+
// Unimplemented.
|
|
322
|
+
}
|
|
323
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
324
|
+
async resumeSending(localId) {
|
|
325
|
+
// Unimplemented.
|
|
326
|
+
}
|
|
327
|
+
async replaceTrack(
|
|
328
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
329
|
+
localId, track) {
|
|
330
|
+
throw new errors_1.UnsupportedError('not implemented');
|
|
331
|
+
}
|
|
332
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
333
|
+
async setMaxSpatialLayer(localId, spatialLayer) {
|
|
334
|
+
throw new errors_1.UnsupportedError(' not implemented');
|
|
335
|
+
}
|
|
336
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
337
|
+
async setRtpEncodingParameters(localId, params) {
|
|
338
|
+
throw new errors_1.UnsupportedError('not supported');
|
|
339
|
+
}
|
|
340
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
341
|
+
async getSenderStats(localId) {
|
|
342
|
+
throw new errors_1.UnsupportedError('not implemented');
|
|
343
|
+
}
|
|
344
|
+
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
345
|
+
var _a;
|
|
346
|
+
this.assertSendDirection();
|
|
347
|
+
const options = {
|
|
348
|
+
negotiated: true,
|
|
349
|
+
id: this._nextSendSctpStreamId,
|
|
350
|
+
ordered,
|
|
351
|
+
maxPacketLifeTime,
|
|
352
|
+
maxRetransmitTime: maxPacketLifeTime,
|
|
353
|
+
maxRetransmits,
|
|
354
|
+
protocol
|
|
355
|
+
};
|
|
356
|
+
logger.debug('sendDataChannel() [options:%o]', options);
|
|
357
|
+
const dataChannel = this._pc.createDataChannel(label, options);
|
|
358
|
+
// Increase next id.
|
|
359
|
+
this._nextSendSctpStreamId =
|
|
360
|
+
++this._nextSendSctpStreamId % SCTP_NUM_STREAMS.MIS;
|
|
361
|
+
// If this is the first DataChannel we need to create the SDP answer with
|
|
362
|
+
// m=application section.
|
|
363
|
+
if (!this._hasDataChannelMediaSection) {
|
|
364
|
+
const offer = await this._pc.createOffer();
|
|
365
|
+
const localSdpObject = sdpTransform.parse(offer.sdp);
|
|
366
|
+
const offerMediaObject = localSdpObject.media
|
|
367
|
+
.find((m) => m.type === 'application');
|
|
368
|
+
if (!this._transportReady) {
|
|
369
|
+
await this.setupTransport({
|
|
370
|
+
localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
|
|
371
|
+
localSdpObject
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
|
|
375
|
+
await this._pc.setLocalDescription(offer);
|
|
376
|
+
this._remoteSdp.sendSctpAssociation({ offerMediaObject });
|
|
377
|
+
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
|
|
378
|
+
logger.debug('sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
|
|
379
|
+
await this._pc.setRemoteDescription(answer);
|
|
380
|
+
this._hasDataChannelMediaSection = true;
|
|
381
|
+
}
|
|
382
|
+
const sctpStreamParameters = {
|
|
383
|
+
streamId: options.id,
|
|
384
|
+
ordered: options.ordered,
|
|
385
|
+
maxPacketLifeTime: options.maxPacketLifeTime,
|
|
386
|
+
maxRetransmits: options.maxRetransmits
|
|
387
|
+
};
|
|
388
|
+
return { dataChannel, sctpStreamParameters };
|
|
389
|
+
}
|
|
390
|
+
async receive(optionsList) {
|
|
391
|
+
var _a;
|
|
392
|
+
this.assertRecvDirection();
|
|
393
|
+
const results = [];
|
|
394
|
+
for (const options of optionsList) {
|
|
395
|
+
const { trackId, kind, rtpParameters, streamId } = options;
|
|
396
|
+
logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
|
|
397
|
+
const mid = kind;
|
|
398
|
+
this._remoteSdp.receive({
|
|
399
|
+
mid,
|
|
400
|
+
kind,
|
|
401
|
+
offerRtpParameters: rtpParameters,
|
|
402
|
+
streamId: streamId || rtpParameters.rtcp.cname,
|
|
403
|
+
trackId
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
|
|
407
|
+
logger.debug('receive() | calling pc.setRemoteDescription() [offer:%o]', offer);
|
|
408
|
+
await this._pc.setRemoteDescription(offer);
|
|
409
|
+
let answer = await this._pc.createAnswer();
|
|
410
|
+
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
411
|
+
for (const options of optionsList) {
|
|
412
|
+
const { kind, rtpParameters } = options;
|
|
413
|
+
const mid = kind;
|
|
414
|
+
const answerMediaObject = localSdpObject.media
|
|
415
|
+
.find((m) => String(m.mid) === mid);
|
|
416
|
+
// May need to modify codec parameters in the answer based on codec
|
|
417
|
+
// parameters in the offer.
|
|
418
|
+
sdpCommonUtils.applyCodecParameters({
|
|
419
|
+
offerRtpParameters: rtpParameters,
|
|
420
|
+
answerMediaObject
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
424
|
+
if (!this._transportReady) {
|
|
425
|
+
await this.setupTransport({
|
|
426
|
+
localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
|
|
427
|
+
localSdpObject
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
|
|
431
|
+
await this._pc.setLocalDescription(answer);
|
|
432
|
+
for (const options of optionsList) {
|
|
433
|
+
const { kind, trackId, rtpParameters } = options;
|
|
434
|
+
const mid = kind;
|
|
435
|
+
const localId = trackId;
|
|
436
|
+
const streamId = options.streamId || rtpParameters.rtcp.cname;
|
|
437
|
+
const stream = this._pc.getRemoteStreams()
|
|
438
|
+
.find((s) => s.id === streamId);
|
|
439
|
+
const track = stream.getTrackById(localId);
|
|
440
|
+
if (!track) {
|
|
441
|
+
throw new Error('remote track not found');
|
|
442
|
+
}
|
|
443
|
+
// Insert into the map.
|
|
444
|
+
this._mapRecvLocalIdInfo.set(localId, { mid, rtpParameters });
|
|
445
|
+
results.push({ localId, track });
|
|
446
|
+
}
|
|
447
|
+
return results;
|
|
448
|
+
}
|
|
449
|
+
async stopReceiving(localIds) {
|
|
450
|
+
this.assertRecvDirection();
|
|
451
|
+
for (const localId of localIds) {
|
|
452
|
+
logger.debug('stopReceiving() [localId:%s]', localId);
|
|
453
|
+
const { mid, rtpParameters } = this._mapRecvLocalIdInfo.get(localId) || {};
|
|
454
|
+
// Remove from the map.
|
|
455
|
+
this._mapRecvLocalIdInfo.delete(localId);
|
|
456
|
+
this._remoteSdp.planBStopReceiving({ mid: mid, offerRtpParameters: rtpParameters });
|
|
457
|
+
}
|
|
458
|
+
const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
|
|
459
|
+
logger.debug('stopReceiving() | calling pc.setRemoteDescription() [offer:%o]', offer);
|
|
460
|
+
await this._pc.setRemoteDescription(offer);
|
|
461
|
+
const answer = await this._pc.createAnswer();
|
|
462
|
+
logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
|
|
463
|
+
await this._pc.setLocalDescription(answer);
|
|
464
|
+
}
|
|
465
|
+
async pauseReceiving(
|
|
466
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
467
|
+
localIds) {
|
|
468
|
+
// Unimplemented.
|
|
469
|
+
}
|
|
470
|
+
async resumeReceiving(
|
|
471
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
472
|
+
localIds) {
|
|
473
|
+
// Unimplemented.
|
|
474
|
+
}
|
|
475
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
476
|
+
async getReceiverStats(localId) {
|
|
477
|
+
throw new errors_1.UnsupportedError('not implemented');
|
|
478
|
+
}
|
|
479
|
+
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
480
|
+
var _a;
|
|
481
|
+
this.assertRecvDirection();
|
|
482
|
+
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
483
|
+
const options = {
|
|
484
|
+
negotiated: true,
|
|
485
|
+
id: streamId,
|
|
486
|
+
ordered,
|
|
487
|
+
maxPacketLifeTime,
|
|
488
|
+
maxRetransmitTime: maxPacketLifeTime,
|
|
489
|
+
maxRetransmits,
|
|
490
|
+
protocol
|
|
491
|
+
};
|
|
492
|
+
logger.debug('receiveDataChannel() [options:%o]', options);
|
|
493
|
+
const dataChannel = this._pc.createDataChannel(label, options);
|
|
494
|
+
// If this is the first DataChannel we need to create the SDP offer with
|
|
495
|
+
// m=application section.
|
|
496
|
+
if (!this._hasDataChannelMediaSection) {
|
|
497
|
+
this._remoteSdp.receiveSctpAssociation({ oldDataChannelSpec: true });
|
|
498
|
+
const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
|
|
499
|
+
logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]', offer);
|
|
500
|
+
await this._pc.setRemoteDescription(offer);
|
|
501
|
+
const answer = await this._pc.createAnswer();
|
|
502
|
+
if (!this._transportReady) {
|
|
503
|
+
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
504
|
+
await this.setupTransport({
|
|
505
|
+
localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
|
|
506
|
+
localSdpObject
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
|
|
510
|
+
await this._pc.setLocalDescription(answer);
|
|
511
|
+
this._hasDataChannelMediaSection = true;
|
|
512
|
+
}
|
|
513
|
+
return { dataChannel };
|
|
514
|
+
}
|
|
515
|
+
async setupTransport({ localDtlsRole, localSdpObject }) {
|
|
516
|
+
if (!localSdpObject) {
|
|
517
|
+
localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
|
|
518
|
+
}
|
|
519
|
+
// Get our local DTLS parameters.
|
|
520
|
+
const dtlsParameters = sdpCommonUtils.extractDtlsParameters({ sdpObject: localSdpObject });
|
|
521
|
+
// Set our DTLS role.
|
|
522
|
+
dtlsParameters.role = localDtlsRole;
|
|
523
|
+
// Update the remote DTLS role in the SDP.
|
|
524
|
+
this._remoteSdp.updateDtlsRole(localDtlsRole === 'client' ? 'server' : 'client');
|
|
525
|
+
// Need to tell the remote transport about our parameters.
|
|
526
|
+
await new Promise((resolve, reject) => {
|
|
527
|
+
this.safeEmit('@connect', { dtlsParameters }, resolve, reject);
|
|
528
|
+
});
|
|
529
|
+
this._transportReady = true;
|
|
530
|
+
}
|
|
531
|
+
assertSendDirection() {
|
|
532
|
+
if (this._direction !== 'send') {
|
|
533
|
+
throw new Error('method can just be called for handlers with "send" direction');
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
assertRecvDirection() {
|
|
537
|
+
if (this._direction !== 'recv') {
|
|
538
|
+
throw new Error('method can just be called for handlers with "recv" direction');
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
exports.Chrome55 = Chrome55;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { HandlerFactory, HandlerInterface, HandlerRunOptions, HandlerSendOptions, HandlerSendResult, HandlerReceiveOptions, HandlerReceiveResult, HandlerSendDataChannelOptions, HandlerSendDataChannelResult, HandlerReceiveDataChannelOptions, HandlerReceiveDataChannelResult } from './HandlerInterface';
|
|
2
|
+
import { IceParameters } from '../Transport';
|
|
3
|
+
import { RtpCapabilities } from '../RtpParameters';
|
|
4
|
+
import { SctpCapabilities } from '../SctpParameters';
|
|
5
|
+
export declare class Chrome67 extends HandlerInterface {
|
|
6
|
+
private _direction?;
|
|
7
|
+
private _remoteSdp?;
|
|
8
|
+
private _sendingRtpParametersByKind?;
|
|
9
|
+
private _sendingRemoteRtpParametersByKind?;
|
|
10
|
+
private _forcedLocalDtlsRole?;
|
|
11
|
+
private _pc;
|
|
12
|
+
private readonly _sendStream;
|
|
13
|
+
private readonly _mapSendLocalIdRtpSender;
|
|
14
|
+
private _nextSendLocalId;
|
|
15
|
+
private readonly _mapRecvLocalIdInfo;
|
|
16
|
+
private _hasDataChannelMediaSection;
|
|
17
|
+
private _nextSendSctpStreamId;
|
|
18
|
+
private _transportReady;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a factory function.
|
|
21
|
+
*/
|
|
22
|
+
static createFactory(): HandlerFactory;
|
|
23
|
+
constructor();
|
|
24
|
+
get name(): string;
|
|
25
|
+
close(): void;
|
|
26
|
+
getNativeRtpCapabilities(): Promise<RtpCapabilities>;
|
|
27
|
+
getNativeSctpCapabilities(): Promise<SctpCapabilities>;
|
|
28
|
+
run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }: HandlerRunOptions): void;
|
|
29
|
+
updateIceServers(iceServers: RTCIceServer[]): Promise<void>;
|
|
30
|
+
restartIce(iceParameters: IceParameters): Promise<void>;
|
|
31
|
+
getTransportStats(): Promise<RTCStatsReport>;
|
|
32
|
+
send({ track, encodings, codecOptions, codec }: HandlerSendOptions): Promise<HandlerSendResult>;
|
|
33
|
+
stopSending(localId: string): Promise<void>;
|
|
34
|
+
pauseSending(localId: string): Promise<void>;
|
|
35
|
+
resumeSending(localId: string): Promise<void>;
|
|
36
|
+
replaceTrack(localId: string, track: MediaStreamTrack | null): Promise<void>;
|
|
37
|
+
setMaxSpatialLayer(localId: string, spatialLayer: number): Promise<void>;
|
|
38
|
+
setRtpEncodingParameters(localId: string, params: any): Promise<void>;
|
|
39
|
+
getSenderStats(localId: string): Promise<RTCStatsReport>;
|
|
40
|
+
sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }: HandlerSendDataChannelOptions): Promise<HandlerSendDataChannelResult>;
|
|
41
|
+
receive(optionsList: HandlerReceiveOptions[]): Promise<HandlerReceiveResult[]>;
|
|
42
|
+
stopReceiving(localIds: string[]): Promise<void>;
|
|
43
|
+
pauseReceiving(localIds: string[]): Promise<void>;
|
|
44
|
+
resumeReceiving(localIds: string[]): Promise<void>;
|
|
45
|
+
getReceiverStats(localId: string): Promise<RTCStatsReport>;
|
|
46
|
+
receiveDataChannel({ sctpStreamParameters, label, protocol }: HandlerReceiveDataChannelOptions): Promise<HandlerReceiveDataChannelResult>;
|
|
47
|
+
private setupTransport;
|
|
48
|
+
private assertSendDirection;
|
|
49
|
+
private assertRecvDirection;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=Chrome67.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chrome67.d.ts","sourceRoot":"","sources":["../../src/handlers/Chrome67.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAY,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,eAAe,EAAiB,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAM3E,qBAAa,QAAS,SAAQ,gBAAgB;IAG7C,OAAO,CAAC,UAAU,CAAC,CAAkB;IAErC,OAAO,CAAC,UAAU,CAAC,CAAY;IAE/B,OAAO,CAAC,2BAA2B,CAAC,CAAmC;IAGvE,OAAO,CAAC,iCAAiC,CAAC,CAAmC;IAG7E,OAAO,CAAC,oBAAoB,CAAC,CAAW;IAExC,OAAO,CAAC,GAAG,CAAM;IAEjB,OAAO,CAAC,QAA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