The top-level module exported by the mediasoup module.
const mediasoup = require("mediasoup");
Provides access to the errors module.
Returns a new Server instance.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
settings |
ServerSettings | Server settings. | No |
Usage example:
const server = mediasoup.Server(
{
logLevel : "warn",
rtcIPv4 : "1.2.3.4",
rtcIPv6 : false,
dtlsCertificateFile : "/home/foo/dtls-cert.pem",
dtlsPrivateKeyFile : "/home/foo/dtls-key.pem"
});
A server
runs and manages a set of mediasoup worker child processes that handle media realtime-communications (ICE, DTLS, RTP, RTCP, DataChannel, etc.).
Field | Type | Description | Required | Default |
---|---|---|---|---|
numWorkers |
Number | Number of child worker processes. | No | Number of CPU cores in the host |
logLevel |
String | Logging level for logs generated by the media worker subprocesses (check the Debugging documentation). Valid values are “debug”, “warn”, “error”. | No | “error” |
logTags |
Array | Log tags for debugging. Check the list of available tags in Debugging documentation. | No | [ ] |
rtcIPv4 |
String|Boolean | IPv4 for RTC. Valid values are a IPv4, true (auto-detect) and false (disabled). |
No | true |
rtcIPv6 |
String|Boolean | IPv6 for RTC. Valid values are a IPv6, true (auto-detect) and false (disabled). |
No | true |
rtcAnnouncedIPv4 |
String | Announced IPv4 for RTC. Useful for deployments in server with private IP such as AWS. Valid values are a IPv4. | No | |
rtcAnnouncedIPv6 |
String | Announced IPv6 for RTC. Useful for deployments in server with private IP such as AWS. Valid values are a IPv6. | No | |
rtcMinPort |
Number | Minimun RTC port. | No | 10000 |
rtcMaxPort |
Number | Maximum RTC port. | No | 59999 |
dtlsCertificateFile |
String | Path to the DTLS certificate. If unset, a random certificate is generated. | No | |
dtlsPrivateKeyFile |
String | Path to the DTLS private key. If unset, a random certificate is generated. | No |
Field | Type | Description | Required | Default |
---|---|---|---|---|
logLevel |
String | Logging level for logs generated by the media worker subprocesses (check the Debugging documentation). Valid values are “debug”, “warn”, “error”. | No | |
logTags |
Array | Log tags for debugging. Check the list of available tags in Debugging documentation. | No |
A boolean indicating whether the server
has been closed.
The number of available workers (it matches numWorkers
in ServerSettings if given).
Closes the server
, including all its rooms
, and triggers a close
event.
Updates the server
settings in runtime. Just a subset of the full ServerSettings can be updated.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
settings |
ServerUpdateableSettings | Server settings. | No |
Creates and returns a new Room instance.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
mediaCodecs |
sequence<RoomMediaCodec> | Room media codecs. | Yes | |
options |
Object | Optional room options | No |
options
allows the following items:
Field | Type | Description | Required | Default |
---|---|---|---|---|
workerIdx |
Number | Worker index (from 0 to server.numWorkers - 1) to let the app select a specific worker to handle this room. If unset, the worker is chosen incrementally. |
No |
Usage example:
const mediaCodecs =
[
{
kind : "audio",
name : "opus",
clockRate : 48000,
channels : 2,
parameters :
{
useinbandfec : 1
}
},
{
kind : "video",
name : "VP8",
clockRate : 90000
},
{
kind : "video",
name : "H264",
clockRate : 90000,
parameters :
{
"packetization-mode" : 1,
"profile-level-id" : "42e01f",
"level-asymmetry-allowed" : 1
}
}
];
const room = server.Room(mediaCodecs);
The Server
class inherits from EventEmitter.
Emitted when the server
is closed.
Emitted when a new room
is created.
Argument | Type | Description |
---|---|---|
room |
Room | New room . |
A room
holds a multiparty RTC (Real-Time Communication) conference.
For more information, check the Glossary section.
Field | Type | Description | Required | Default |
---|---|---|---|---|
kind |
String | Media kind (“audio” or “video”). | Yes | |
name |
String | The codec MIME subtype. Valid values are listed in IANA-RTP-2. Examples: “opus”, “VP8”, “H264”. | Yes | |
mimetype |
String | The codec MIME type, i.e. “audio/opus”, “video/VP8”, etc. The list of mediasoup supported codecs is the mediasoup/lib/supportedRtpCapabilities.js file. | Yes | |
clockRate |
Number | Codec clock rate expressed in Hertz. | Yes | |
channels |
Number | The number of channels (mono=1, stereo=2) for audio codecs. | No | 1 |
parameters |
Dictionary | Codec-specific parameters available for signaling. | No |
Feature codecs such as RTX or FEC must NOT be placed into Room mediaCodecs
.
Field | Type | Description | Required | Default |
---|---|---|---|---|
producer |
Producer | producer generating audio. |
Yes | |
audioLevel |
Number | Audio level in dBov (0 means maximum level, -127 means no audio). | Yes |
Unique identifier (Number).
A Boolean indicating whether the room
has been closed.
An Object with the RTP capabilities of the room
, miming the syntax of RTCRtpCapabilities in ORTC.
An Array with the list of Peer instances in the room
.
Closes the room
, including all its peers
, and triggers a close
event.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
appData |
Any | Custom app data. | No |
Retrieves the Peer with the given name
, or undefined
if not found.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
name |
String | Peer name. | Yes |
Provide the room
with a mediasoup protocol request payload (commonly generated by mediasoup-client).
Argument | Type | Description | Required | Default |
---|---|---|---|---|
request |
Object | mediasoup protocol request. | Yes |
Just mediasoup protocol requests with “room” target must be given to this method, meaning that the mediasoup protocol payload:
target: "room"
, andnotification: true
.The method returns a Promise resolving to a mediasoup protocol response payload that must be sent back to the request originator.
Usage example:
// Here we assume a custom WebSocket based signaling protocol.
// * request: A mediasoup protocol request payload with target: "room".
// * accept: A function to tell our signaling protocol to accept the request.
// * reject: A function to tell our signaling protocol to reject the request.
function handleRequestFromMediasoupClient(request, accept, reject)
{
switch (request.method)
{
case "queryRoom":
{
mediasoupRoom.receiveRequest(request)
.then((response) => accept(response))
.catch((error) => reject(500, error.toString()));
break;
}
case "join":
{
const { peerName, spy } = request;
// Here we may want to check whether `spy` is `true` and allow or reject
// this join request based on app logic/policy.
mediasoupRoom.receiveRequest(request)
.then((response) =>
{
// Get the new mediasoup Peer instance.
const peer = mediasoupRoom.getPeerByName(peerName);
console.info("new peer joined the room: %o", peer);
accept(response);
})
.catch((error) => reject(500, error.toString()));
break;
}
}
}
Creates and returns a new ActiveSpeakerDetector.
Returns a Promise resolving to a new RtpStreamer associated to the given producer
.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
producer |
Producer | Associated producer . |
Yes | |
options |
RtpStreamerOptions | Options for the rtpStreamer . |
Yes |
The Room
class inherits from EventEmitter.
Emitted when the room
is closed.
Argument | Type | Description |
---|---|---|
appData |
Any | Custom app data. |
Emitted when a new peer
is created.
Argument | Type | Description |
---|---|---|
peer |
Peer | New peer . |
Emitted every few milliseconds. It provides information regarding the audio level of each audio producer
in the room
.
Argument | Type | Description |
---|---|---|
audioLevelInfos |
sequence<AudioLevelInfo> | Audio level information entries ordered by audioLevel (higher first). |
A peer
is the local representation of a remote media endpoint that connects to mediasoup and sends/receives media streams.
For more information, check the Glossary section.
The name
(String) of the peer
.
A Boolean indicating whether the peer
has been closed.
Custom data set by the application. When the peer
is created via the mediasoup protocol, the appData
is filled with the corresponding field in the join
request.
An Object with the RTP capabilities of the peer
, miming the syntax of RTCRtpCapabilities in ORTC.
An Array with the list of WebRtcTransport instances associated to the peer
in the order in which they were created.
An Array with the list of Producer instances associated to the peer
in the order in which they were created.
An Array with the list of Consumer instances associated to the peer
in the order in which they were created.
Closes the peer
, including all its transports
, producers
and consumers
, and triggers a close
event.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
appData |
Any | Custom app data. | No |
Retrieves the WebRtcTransport with the given id
, or undefined
if not found.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
id |
Number | WebRtcTransport id. | Yes |
Retrieves the Producer with the given id
, or undefined
if not found.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
id |
Number | Producer id. | Yes |
Retrieves the Consumer with the given id
, or undefined
if not found.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
id |
Number | Consumer id. | Yes |
Provide the peer
with a mediasoup protocol request payload (commonly generated by mediasoup-client).
Argument | Type | Description | Required | Default |
---|---|---|---|---|
request |
Object | mediasoup protocol request. | Yes |
Just mediasoup protocol requests with “peer” target must be given to this method, meaning that the mediasoup protocol payload:
target: "peer"
, andnotification: true
.The method returns a Promise resolving to a mediasoup protocol response payload that must be sent back to the request originator.
Provide the peer
with a mediasoup protocol notification payload (commonly generated by mediasoup-client).
Argument | Type | Description | Required | Default |
---|---|---|---|---|
notification |
Object | mediasoup protocol notification. | Yes |
Just mediasoup protocol notifications with “peer” target must be given to this method, meaning that the mediasoup protocol payload:
target: "peer"
, andnotification: true
.The method does not return anything.
The Peer
class inherits from EventEmitter.
Emitted when the peer
is closed.
Argument | Type | Description |
---|---|---|
originator |
String | “local” or “remote”. |
appData |
Any | Custom app data. |
Emitted when a new mediasoup protocol notification must be sent by the Node.js application to the associated mediasoup-client.
Argument | Type | Description |
---|---|---|
notification |
Object | mediasoup protocol notification. |
Emitted when a new webrtcTransport
is created.
Argument | Type | Description |
---|---|---|
webrtcTransport |
WebRtcTransport | New webrtcTransport . |
Emitted when a new producer
is created.
Argument | Type | Description |
---|---|---|
producer |
Producer | New producer . |
Emitted when a new consumer
is created.
Argument | Type | Description |
---|---|---|
consumer |
Consumer | New consumer . |
A transport
represents a path for sending or receiving audio/video RTP.
For more information, check the Glossary section.
Currently mediasoup implements two transport types:
Field | Type | Description | Required | Default |
---|---|---|---|---|
usernameFragment |
String | ICE username fragment. | No | |
password |
String | ICE password. | No | |
iceLite |
Boolean | ICE Lite. | No |
Field | Type | Description | Required | Default |
---|---|---|---|---|
foundation |
String | Unique identifier that allows ICE to correlate candidates that appear on multiple transports . |
Yes | |
priority |
Number | The assigned priority of the candidate. | Yes | |
ip |
String | The IP address of the candidate. | Yes | |
protocol |
String | The protocol of the candidate (“udp” / “tcp”). | Yes | |
port |
Number | The port for the candidate. | Yes | |
type |
String | The type of candidate (always “host”). | Yes | |
tcpType |
String | The type of TCP candidate (always “passive”). | No |
Field | Type | Description | Required | Default |
---|---|---|---|---|
localIP |
String | Local IP of the tuple. | Yes | |
localPort |
Number | Local port of the tuple. | Yes | |
remoteIP |
String | Remote IP of the tuple. | Yes | |
remotePort |
Number | Remote port of the tuple. | Yes | |
protocol |
String | The protocol of the tuple (“udp” / “tcp”). | Yes |
Field | Type | Description | Required | Default |
---|---|---|---|---|
role |
DtlsRole | Local DTLS role. | No | “auto” |
fingerprints |
LocalDtlsFingerprints | Local DTLS fingerprints. | Yes |
Map of DTLS algorithms (as defined in the “Hash function Textual Names” registry initially specified in RFC 4572 Section 8) and their corresponding certificate fingerprint values (in lowercase hex string as expressed utilizing the syntax of “fingerprint” in RFC 4572 Section 5).
Field | Type | Description | Required | Default |
---|---|---|---|---|
sha-1 |
String | SHA-1 certificate fingerprint. | Yes | |
sha-224 |
String | SHA-224 certificate fingerprint. | Yes | |
sha-256 |
String | SHA-256 certificate fingerprint. | Yes | |
sha-384 |
String | SHA-384 certificate fingerprint. | Yes | |
sha-512 |
String | SHA-512 certificate fingerprint. | Yes |
Field | Type | Description | Required | Default |
---|---|---|---|---|
role |
DtlsRole | Remote DTLS role. | No | “auto” |
fingerprint |
RemoteDtlsFingerprint | Remote DTLS fingerprint. | Yes |
Field | Type | Description | Required | Default |
---|---|---|---|---|
algorithm |
String | Hash function algorithm (“sha-1” / “sha-224” / “sha-256” / “sha-384” / “sha-512”). | Yes | |
value |
String | Certificate fingerprint in lowercase hex. | Yes |
Value | Description |
---|---|
“new” | No ICE Binding Requests have been received yet. |
“connected” | Valid ICE Binding Request have been received, but none with USE-CANDIDATE attribute. Outgoing media is allowed. |
“completed” | ICE Binding Request with USE_CANDIDATE attribute has been received. Media in both directions is now allowed. |
“disconnected” | ICE was “connected” or “completed” but it has suddenly failed (currently this can just happen if the selected tuple has “tcp” protocol). |
“closed” | ICE state when the transport has been closed. |
Value | Description |
---|---|
“auto” | The DTLS role is determined based on the resolved ICE role (the “controlled” role acts as DTLS client, the “controlling” role acts as DTLS server”). Since mediasoup is a ICE Lite implementation it always behaves as ICE “controlled”. |
“client” | DTLS client role. |
“server” | DTLS server role. |
Value | Description |
---|---|
“new” | DTLS procedures not yet initiated. |
“connecting” | DTLS connecting. |
“connected” | DTLS successfully connected (SRTP keys already extracted). |
“failed” | DTLS connection failed. |
“closed” | DTLS state when the transport has been closed. |
A webrtcTransport
represents a network path negotiated by both, mediasoup-client and mediasoup, via ICE and DTLS.
For more information, check the Glossary section.
mediasoup is a ICE Lite implementation, meaning that it will never initiate ICE connections but expect ICE Binding Requests on its open ports.
Field | Type | Description | Required | Default |
---|---|---|---|---|
remoteIP |
String | Destination IP. | Yes | |
remotePort |
Number | Destination port. | Yes | |
localIP |
String | Local IP. | No | rtcIPv4 or rtcIPv6 given in ServerSettings |
sendRtp |
Boolean | Whether RTP sent to the client must be mirrored. | No | true |
sendRtcp |
Boolean | Whether RTCP sent to the client must be mirrored. | No | true |
recvRtp |
Boolean | Whether RTP received from the client must be mirrored. | No | true |
recvRtcp |
Boolean | Whether RTCP received from the client must be mirrored. | No | true |
If localIP
is given, the RTP port range given in ServerSettings (rtcMinPort
- rtcMaxPort
) is not honored and, instead, any available random port will be used.
Unique identifier (Number).
A Boolean indicating whether the webrtcTransport
has been closed.
Custom data set by the application. When the webrtcTransport
is created via the mediasoup protocol, the appData
is filled with the corresponding field in the createTransport
request.
A String (“send” or “recv”) representing the direction of the media over this webrtcTransport
.
String indicating the ICE role of the webrtcTransport
. Due to the ICE Lite design, this is always “controlled”.
Local IceParameters of the webrtcTransport
.
Sequence of local IceCandidate Objects associated to this webrtcTransport
.
The current IceState of the webrtcTransport
.
The selected IceSelectedTuple indicating information about the selected ICE candidate pair.
It is undefined
if ICE is not yet established (no working candidate pair was found).
LocalDtlsParameters of the webrtcTransport
.
The current DtlsState of the webrtcTransport
.
The remote certificate in PEM format (String). It is set once dtlsState
becomes “connected”.
The application may want to inspect the remote certificate for authorization purposes by using some certificates utility such as the Node pem module.
Closes the webrtcTransport
and triggers a close
event.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
appData |
Any | Custom app data. | No |
Set maximum bitrate for media streams sent by the remote endpoint over this webrtcTransport
. Returns a Promise that resolves to this webrtcTransport
.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
bitrate |
Number | Maximum sending bitrate in bps . |
Yes | 0 (no limit) |
This method can just be called on open webrtcTransports
with direction: "send"
(it will throw otherwise).
Usage example:
peer.on('newtransport', (webrtcTransport) =>
{
if (webrtcTransport.direction === 'send')
webrtcTransport.setMaxBitrate(250000);
});
Returns a Promise resolving to an array of Objects containing RTC stats related to the webrtcTransport
.
Check the RTC stats section for more details.
Enables RTP/RTCP mirroring. The selected RTP/RTCP over this webrtcTransport
will be sent to the given address (see options
).
Argument | Type | Description | Required | Default |
---|---|---|---|---|
options |
MirroringOptions | Options. | Yes |
Stops RTP/RTCP mirroring.
The WebRtcTransport
class inherits from EventEmitter.
Emitted when the webrtcTransport
is closed.
Argument | Type | Description |
---|---|---|
originator |
String | “local” or “remote”. |
appData |
Any | Custom app data. |
Emitted when the ICE selected tuple changes.
Argument | Type | Description |
---|---|---|
iceSelectedTuple |
IceSelectedTuple | The new ICE selected tuple. |
Emitted when the ICE state changes.
Argument | Type | Description |
---|---|---|
iceState |
IceState | The new ICE state. |
Emitted when the DTLS state changes.
Argument | Type | Description |
---|---|---|
dtlsState |
DtlsState | The new DTLS state. |
A plainRtpTransport
represents a network path negotiated on which plain RTP and RTCP (no ICE nor DTLS) is carried.
Field | Type | Description | Required | Default |
---|---|---|---|---|
ip |
String | Destination IP. | Yes | |
port |
Number | Destination port. | Yes |
Unique identifier (Number).
A Boolean indicating whether the plainRtpTransport
has been closed.
The 5-Tuple indicating information about the connection.
The local IP address
(String) of the transport
.
The local port
(Number) of the transport
.
Closes the plainRtpTransport
.
Set the remote IP address
and port
for the plainRtpTransport
.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
parameters |
PlainRtpRemoteParameters | Remote parameters. | Yes |
A producer
represents an audio/video media track sent to the room
.
For more information, check the Glossary section.
Unique identifier (Number).
A Boolean indicating whether the producer
has been closed.
Custom data set by the application. When the producer
is created via the mediasoup protocol, the appData
is filled with the corresponding field in the createProducer
request.
The media kind (“audio” or “video”) handled by the producer
.
The Peer owner of this producer
.
The Transport assigned to this producer
.
An Object with the effective RTP parameters of the producer
, miming the syntax of RTCRtpParameters in ORTC.
Boolean indicating whether this producer
has been locally paused (in mediasoup).
Boolean indicating whether this producer
has been remotely paused (by the remote client).
Boolean indicating whether this producer
has been locally or remotely paused.
String indicating the preferred RTP profile set via producer.setPreferredProfile()
.
Closes the producer
and triggers a close
event.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
appData |
Any | Custom app data. | No |
Pauses the producer
locally, meaning that no RTP will be relayed to its associated consumers
.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
appData |
Any | Custom app data sent to the remote client. | No |
Resumes the producer
locally, meaning that RTP will be relayed again to its associated consumers
(unless the producer
was also remotely paused).
Argument | Type | Description | Required | Default |
---|---|---|---|---|
appData |
Any | Custom app data sent to the remote client. | No |
Set the given RTP profile
as the desired profile for all its associated consumers
.
For more information, check the Glossary section.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
profile |
String | Preffered RTP profile. | Yes |
Returns a Promise resolving to an array of Objects containing RTC stats related to the producer
.
Check the RTC stats section for more details.
The Producer
class inherits from EventEmitter.
Emitted when the producer
is closed.
Argument | Type | Description |
---|---|---|
originator |
String | “local” or “remote”. |
appData |
Any | Custom app data. |
Emitted when the producer
is locally or remotely paused.
Argument | Type | Description |
---|---|---|
originator |
String | “local” or “remote”. |
appData |
Any | Custom app data. |
Emitted when the producer
is locally or remotely resumed.
Argument | Type | Description |
---|---|---|
originator |
String | “local” or “remote”. |
appData |
Any | Custom app data. |
A consumer
represents an audio/video media track sent to a remote client.
For more information, check the Glossary section.
Unique identifier (Number).
A Boolean indicating whether the consumer
has been closed.
Custom data set by the application.
The media kind (“audio” or “video”) handled by the consumer
.
The Peer owner of this consumer
(if any).
The Transport assigned to this consumer
.
An Object with the effective RTP parameters of the consumer
, miming the syntax of RTCRtpParameters in ORTC.
The RTP source of this consumer
. Typically it corresponds to a Producer.
Boolean indicating whether this consumer
has been enabled (so the endpoint can receive RTP). Being enabled also means that a transport
has been assigned to this consumer
.
Boolean indicating whether this consumer
has been locally paused (in mediasoup).
Boolean indicating whether this consumer
has been remotely paused (by the remote client).
Boolean indicating whether the source of this consumer
has been paused.
Boolean indicating whether this consumer
has been locally or remotely paused, or its source has been paused.
String indicating the preferred RTP profile set via consumer.setPreferredProfile()
.
String indicating the effective current RTP profile of this consumer
.
Closes the consumer
and triggers a close
event.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
appData |
Any | Custom app data. | No |
Pauses the consumer
locally, meaning that no RTP will be relayed to the remote client.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
appData |
Any | Custom app data sent to the remote client. | No |
Resumes the consumer
locally, meaning that RTP will be relayed again to the remote client (unless the consumer
was also remotely paused).
Argument | Type | Description | Required | Default |
---|---|---|---|---|
appData |
Any | Custom app data sent to the remote client. | No |
Set the given RTP profile
as the desired profile. No profile higher than the given one will become effective profile for this consumer
.
For more information, check the Glossary section.
Argument | Type | Description | Required | Default |
---|---|---|---|---|
profile |
String | Preffered RTP profile. | Yes |
If no preferred profile is set into a consumer
(meaning that “default” will be used) and the associated source (producer
) has a preferred profile, that will be used in the consumer
.
Request a RTCP PLI to the RTP source (if supported).
Returns a Promise resolving to an array of Objects containing RTC stats related to the consumer
.
Check the RTC stats section for more details.
The Consumer
class inherits from EventEmitter.
Emitted when the consumer
is closed.
Argument | Type | Description |
---|---|---|
originator |
String | “local” or “remote”. |
appData |
Any | Custom app data. |
Emitted when the consumer
is locally or remotely paused.
Argument | Type | Description |
---|---|---|
originator |
String | “local” or “remote”. |
appData |
Any | Custom app data. |
Emitted when the consumer
is locally or remotely resumed.
Argument | Type | Description |
---|---|---|
originator |
String | “local” or “remote”. |
appData |
Any | Custom app data. |
Emitted when the effective profile changes.
Argument | Type | Description |
---|---|---|
profile |
String | Current effective RTP profile. |
Emitted when a transport
is given to this consumer
.
Emitted when the associated transport
is closed.
An activeSpeakerDetector
provides the room
with the highest audio volume level.
The ActiveSpeakerDetector
mechanism is based on the audiolevels
event of the room
.
Closes the activeSpeakerDetector
and triggers a close
event.
The ActiveSpeakerDetector
class inherits from EventEmitter.
Emitted when the activeSpeakerDetector
is closed.
Emitted when a new active speaker is detected.
Both peer
and producer
can be undefined
when no active speaker is detected.
An rtpStreamer
represents both a specialized Consumer and a PlainRtpTransport. It's created by calling the room.createRtpStreamer()
by passing a Producer and RtpStreamOptions.
The RTP and RTCP received by the producer
will be relayed/mirrored to the given IP and port using plain RTP/RTCP.
Field | Type | Description | Required | Default |
---|---|---|---|---|
remoteIP |
String | Destination IP. | Yes | |
remotePort |
Number | Destination port. | Yes | |
localIP |
String | Local IP. | No | rtcIPv4 or rtcIPv6 given in ServerSettings |
If localIP
is given, the RTP port range given in ServerSettings (rtcMinPort
- rtcMaxPort
) is not honored and, instead, any available random port will be used.
The generated Consumer instance.
The generated PlainRtpTransport instance.
Closes the rtpStreamer
, including its consumer
and transport
, and triggers a close
event.
The RtpStreamer
class inherits from EventEmitter.
Emitted when the rtpStreamer
is closed.
The errors
module (exported via mediasoup.errors
) holds custom Error classes internally used by mediasoup.
This error happens when an API method is called on an Object in invalid state (for example when such an Object is closed).