View Source Media Events
Below are described all messages, which are sent between Engine and client. Firstly there are tables with names and short descriptions. On the end, there are bullet points with a longer description and format of each media_event. Each media event have to be sent in the form:
{
type: name,
data: data
}
The format described on the end represents data from the above JSON, where the name of the message is the value of the type field.
RTC Engine receives these types of media_events from client:
Name | Description |
---|---|
join | message is sent when peer join RTC Engine |
leave | message is sent when peer leave RTC Engine |
updatePeerMetadata | message contains new metadata of peer |
updateTrackMetadata | message contains new metadata of track |
custom | message is forwarded to the endpoint associated with the peer |
RTC Engine sends these types of messages to the client:
Name | Description |
---|---|
tracksPriority | message contains all tracks that will be forwarded to peer until next tracks_priority message |
peerDenied | message sent, if peer was rejected by server during joining to server |
peerUpdated | message contains new metadata of peer |
trackUpdated | message contains new metadata of track |
custom | custom message forwarded from endpoint to client |
tracksAdded | message sent after some tracks added by some peer |
tracksRemoved | message contains list of tracks which are removed by some peer |
peerJoined | message is sent after new peer joined RTC Engine |
peerAccepted | message is sent to peer after he join RTC Engine |
peerLeft | message is sent, when some peer left |
peerRemoved | message is sent when peer is unwillingly removed by the server |
webrtc-custom-media-events
WebRTC custom media events
WebRTC endpoint receives these types of custom_media_events from client:
Name | Description |
---|---|
renegotiateTracks | message informs that a peer wants to make renegotiation |
prioritizeTrack | message informs about, which track peer want to prioritize |
unprioritizeTrack | message informs about, which track peer want to unprioritize |
prefereVideoSizes | message informs of how many videos in different quality, peer wants to receive |
candidate | message informs about ICE candidate |
sdpOffer | message informs all needed information for SDP negotiation |
WebRTC endpoint sends these type of custom messages to client
Name | Description |
---|---|
offerData | message informs about data needed |
candidate | message informs about ICE candidate |
sdpAnswer | message informs about SDP Answer |
join
join
- this message is sent when peer want to join RTC Engine. It contains only peer metadata
{ "metadata": any }
leave
leave
- this message is sent when peer leave RTC Engine. It contains no data
{}
updatepeermetadata
updatePeerMetadata
- this message contains new metadata of some peer
{ "metadata": any }
updatetrackmetadata
updateTrackMetadata
- this message contains new metadata of some track and id of this track
{ "trackId": track_id, "trackMetadata": any }
custom
custom
- this message is a black box for RTC Engine and it is forwarded to the endpoint associated with the peer
any
trackspriority
tracksPriority
- this message contains all tracks that will be forwarded to peer untill next tracks_priority message this type of messages is sent only if DisplayManager is spawned
{ tracks: tracks }
peerdenied
peerDenied
- this message is sent, if peer was rejected by server during joining to server. It can cointains a information why he was rejected
{ data: text }
peerupdated
peerUpdated
- this message contains information about updated metadata of one of peers
{ peerId: peer_id, metadata: any }
trackupdated
trackUpdated
- this message contains information about new metadata of one of tracks
{ peerId: peer_id, trackId: track_id, metadata: any }
custom-1
custom
- this is custom message forwarded by engine from endpoint to client
any
tracksadded
tracksAdded
- this message informs that one of the peers add track. It contains map track_id to track_metadata of all tracks of one of the peers and id of that peer
{ peerId: peer_id, trackIdToMetadata: { track_id: any } }
tracksremoved
tracksRemoved
- this message contains list of tracks which are removed by some peer and id of that peer
{ peerId: peer_id, trackIds: track_ids }
peerjoined
peerJoined
- this message is sent to all peers in room after new peer joined RTC Engine. It contains id and metadata of new peer.
{ peer: { id: peer.id, metadata: peer.metadata } }
peeraccepted
peerAccepted
- this message is sent to peer after he join RTC Engine. It contains his id and list of information about each peer in Engine (id, metadata and map track_id to track_metadata)
{ id: peer_id, peersInRoom: peers }
peerleft
peerLeft
- this message is sent to all other peers in room, when some peer left. It contains id of peer which left.
{ peerId: peer_id }
peerremoved
peerRemoved
- this message is sent to the peer that has been unwillingly removed by the server
{ peerId: peer_id, reason: any }
renegotiatetracks
renegotiateTracks
- this message informs that a peer wants to make renegotiation due to adding a track or removing a track
{}
prioritizetrack
prioritizeTrack
- this message contains id of track, that peer want to prioritize
{ trackId: trackId }
unprioritizetrack
unprioritizeTrack
- this message contains id of track, that peer want to unprioritize
{ trackId: trackId }
preferevideosizes
prefereVideoSizes
- this message contains information of how many videos in different quality (high, medium, small). There is also flag which indicates that all videos should be in the same quality.
{ bigScreens: Int, mediumScreens: Int, smallScreens: Int, allSameSize: boolean }
candidate
candidate
- this message contains information about ICE candidate it is forwarded to EndpointBin
{ candidate: candidate, sdpMLineIndex: Int }
sdpoffer
sdpOffer
- this message contains SDP offer, map track_id to track_metadata and map mid to track_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 }
offerdata
offerData
- this message contains information about the number of tracks of audio and video that will be sent from engine to 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
- this message contains information about ICE candidate which will be sent to the client
{ candidate: candidate, sdpMLineIndex: sdp_m_line_index, sdpMid: nil, usernameFragment: nil }
sdpanswer
sdpAnswer
- this message contains SDP answer and map mid to track_id
{ type: "answer", sdp: sdp_answer, midToTrackId: mid_to_track_id }
selectencoding
selectEncoding
- this message informs that a peer wants to receive specific encoding of some track
{ peerId => peer_id, trackId => track_id, encoding => encoding }
encodingswitched
encodingSwitched
- this message 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 }