View Source Media Events
This document described all messages exchanged between the RTC Engine and a client. In general, each media event has to be sent in the form:
{
type: name,
data: data
}
where the name of the event is the value of the type
field, while data
should carry the data shown below for every media event
table-of-contents
Table of contents
Below you can find a summary of all media events defined inside membrane_rtc_engine
generic-rtc-engine-messages
Generic RTC Engine messages
Messages used by any RTC Engine plugin
RTC Engine receives these types of media_events
from client:
Name | Description |
---|---|
join | sent when peer join RTC Engine |
leave | sent when peer leaves RTC Engine |
updatePeerMetadata | contains new metadata of a peer |
updateTrackMetadata | contains new metadata of a track |
custom | message forwarded to the endpoint associated with the peer |
RTC Engine sends these types of messages to the client:
Name | Description |
---|---|
tracksPriority | contains all tracks that will be forwarded to peer until next tracks_priority message |
peerDenied | sent if peer was rejected by server when joining to server |
peerUpdated | contains new metadata of a peer |
trackUpdated | contains new metadata of a track |
tracksAdded | sent when some tracks were added by some peer |
tracksRemoved | sent when some tracks were removed by some peer |
peerJoined | sent after a new peer has joined the RTC Engine |
peerAccepted | sent to a peer after he joins the RTC Engine |
peerLeft | sent when some peer lefts the RTC Engine |
peerRemoved | sent when peer is forcibly removed by the server |
error | Notifies about an error that occurred |
custom | custom message forwarded from endpoint to client |
webrtc-custom-media-events
WebRTC custom media events
WebRTC endpoint receives these types of custom media_event
s from client:
Name | Description |
---|---|
renegotiateTracks | A request from a peer to renegotiate tracks |
prioritizeTrack | A request to prioritize the track |
unprioritizeTrack | A request to unprioritize the track |
preferedVideoSizes | informs of how many videos in different quality a peer wants to receive |
candidate | Contains client's ICE candidate |
sdpOffer | Contains an SDP offer from a client |
selectEncoding | A request from a peer to receive a specific encoding of some track |
WebRTC endpoint sends these type of custom messages to client
Name | Description |
---|---|
offerData | Sends data needed by the client to create an offer |
candidate | Contains an ICE candidate |
sdpAnswer | Provides an SDP Answer to the client's offer |
encodingSwitched | An information that a track will be sent with a specific encoding |
client-rtc-engine
Client -> RTC Engine
join
join
Sent when peer want to join RTC Engine. It contains only peer's metadata
{ "metadata": any }
leave
leave
Sent when peer leaves RTC Engine. It contains no data
{}
updatepeermetadata
updatePeerMetadata
Contains new metadata of some peer
{ "metadata": any }
updatetrackmetadata
updateTrackMetadata
Contains new metadata of some track and an id of this track
{ "trackId": track_id, "trackMetadata": any }
custom
custom
A black-box for a message that RTC Engine will forward to the endpoint associated with the peer who sent the message.
any
rtc-engine-client
RTC Engine -> Client
trackspriority
tracksPriority
Contains all tracks that will be forwarded to peer until the next
tracks_priority
message. This type of messages is sent only if DisplayManager is spawned{ tracks: tracks }
peerdenied
peerDenied
Sent if peer was rejected by server when joining to server. It may contain a reason for rejection.
{ data: text }
peerupdated
peerUpdated
Contains information about updated metadata of one of the peers
{ peerId: peer_id, metadata: any }
trackupdated
trackUpdated
Contains information about new metadata of one of tracks
{ peerId: peer_id, trackId: track_id, metadata: any }
tracksadded
tracksAdded
Informs that one of the peers has added one or more tracks. It contains an id of that peer and a map of all tracks with
track_id
s as keys andtrack_metadata
as value.{ peerId: peer_id, trackIdToMetadata: { track_id: any } }
tracksremoved
tracksRemoved
Contains a list of tracks which have been removed by some peer and id of that peer
{ peerId: peer_id, trackIds: track_ids }
peerjoined
peerJoined
Message sent to all peers in the room after a new peer has joined RTC Engine. It contains id and metadata of the new peer.
{ peer: { id: peer.id, metadata: peer.metadata } }
peeraccepted
peerAccepted
Message sent to the peer after he's joined the RTC Engine. It contains his id and a list of information about peers in the Engine (id, metadata and a
trackIdToMetadata
like seen intracksAdded
){ id: peer_id, peersInRoom: peers }
peerleft
peerLeft
Sent to all remaining peers in the room after some peer has left. It contains an id of the peer who left.
{ peerId: peer_id }
peerremoved
peerRemoved
Sent to the peer that has been forcibly removed by the server
{ peerId: peer_id, reason: any }
error
error
Informs that an error occurred on the server providing a message to show
{ message: any() }
custom-1
custom
A black-box for a message that the RTC Engine will forward to the client.
any
client-webrtc-enpoint
Client -> WebRTC Enpoint
renegotiatetracks
renegotiateTracks
Informs that a peer wants to renegotiate connection due to adding a track or removing a track
{}
prioritizetrack
prioritizeTrack
Contains an id of the track that the peer wants to prioritize
{ trackId: trackId }
unprioritizetrack
unprioritizeTrack
Contains an id of the track that the peer want to unprioritize.
{ trackId: trackId }
preferedvideosizes
preferedVideoSizes
Contains information of how many videos in different quality (high, medium, small) the peer would like to receive.
allSameSize
flag which indicates that all videos should be in the same quality.{ bigScreens: Int, mediumScreens: Int, smallScreens: Int, allSameSize: boolean }
candidate
candidate
Contains an ICE candidate that is forwarded to the WebRTC Endpoint
{ candidate: candidate, sdpMLineIndex: Int }
sdpoffer
sdpOffer
Contains an SDP offer, a mapping between
track_id
andtrack_metadata
, and a mapping frommid
totrack_id
. Both maps contains information only about tracks send by peer associated with this endpoint.{ sdpOffer: { type: "offer", sdp: sdp_offer }, trackIdToTrackMetadata: { trackId: any } midToTrackId: mid_to_track_id }
selectencoding
selectEncoding
Informs that a peer wants to receive a specific encoding of some track
{ peerId => peer_id, trackId => track_id, encoding => encoding }
webrtc-enpoint-client
WebRTC Enpoint -> Client
offerdata
offerData
Contains information about the number of audio and video tracks that will be sent from the engine to the peer and information regarding the integrated TURN server.
{ tracksTypes: { audio: Int, video: Int }, integratedTurnServers: [{ serverAddr: addr, serverPort: Int, transport: string, password: string, username: string }] }
candidate-1
candidate
Contains information about an ICE candidate which will be sent to the client
{ candidate: candidate, sdpMLineIndex: sdp_m_line_index, sdpMid: nil, usernameFragment: nil }
sdpanswer
sdpAnswer
Contains an SDP answer and mapping from mid to
track_id
{ type: "answer", sdp: sdp_answer, midToTrackId: mid_to_track_id }
encodingswitched
encodingSwitched
Informs that track with id
trackId
belonging to peer with idpeerId
will be sent in encodingencoding
now.{ peerId: peer_id, trackId: track_id, encoding: encoding }