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:

NameDescription
joinmessage is sent when peer join RTC Engine
leavemessage is sent when peer leave RTC Engine
updatePeerMetadatamessage contains new metadata of peer
updateTrackMetadatamessage contains new metadata of track
custommessage is forwarded to the endpoint associated with the peer

RTC Engine sends these types of messages to the client:

NameDescription
tracksPrioritymessage contains all tracks that will be forwarded to peer until next tracks_priority message
peerDeniedmessage sent, if peer was rejected by server during joining to server
peerUpdatedmessage contains new metadata of peer
trackUpdatedmessage contains new metadata of track
customcustom message forwarded from endpoint to client
tracksAddedmessage sent after some tracks added by some peer
tracksRemovedmessage contains list of tracks which are removed by some peer
peerJoinedmessage is sent after new peer joined RTC Engine
peerAcceptedmessage is sent to peer after he join RTC Engine
peerLeftmessage is sent, when some peer left
peerRemovedmessage 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:

NameDescription
renegotiateTracksmessage informs that a peer wants to make renegotiation
prioritizeTrackmessage informs about, which track peer want to prioritize
unprioritizeTrackmessage informs about, which track peer want to unprioritize
prefereVideoSizesmessage informs of how many videos in different quality, peer wants to receive
candidatemessage informs about ICE candidate
sdpOffermessage informs all needed information for SDP negotiation

WebRTC endpoint sends these type of custom messages to client

NameDescription
offerDatamessage informs about data needed
candidatemessage informs about ICE candidate
sdpAnswermessage 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 id peerId will be sent in encoding encoding now.
  •     {
            peerId: peer_id,
            trackId: track_id,
            encoding: encoding    
        }