The RTCTrackEvent() constructor creates and returns a new RTCTrackEvent object, configured to describe the track which has been added to the RTCPeerConnection.

In general, you won't need to use this constructor, as RTCTrackEvent objects are created by WebRTC and delivered to your RTCPeerConnector's ontrack event handler as appropriate.


trackEvent = new RTCTrackEvent(eventInfo);


An object based on the RTCTrackEventInit dictionary, providing information about the track which has been added to the RTCPeerConnection. This object has the following properties:
The RTCRtpReceiver which is being used to receive the track's media.
streams Optional
An array of MediaStream objects representing each of the streams that comprise the event's corresponding track.
The MediaStreamTrack the event is associated with.
The RTCRtpTransceiver associated with the event.

Return value

A new RTCTrackEvent describing a track which has been added to the RTCPeerConnection.


Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCTrackEvent()' in that specification.
Candidate Recommendation Initial specification.

Browser compatibility

No compatibility data found for api.RTCTrackEvent.RTCTrackEvent.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.