Creates and returns a new RTCTrackEvent object. You will probably not need to create new track events yourself, since they're typically created by the WebRTC infrastructure and sent to the connection's ontrack event handler.
Instance properties
Since RTCTrackEvent is based on Event, its properties are also available.
An array of MediaStream objects, each representing one of the media streams to which the added track belongs. By default, the array is empty, indicating a streamless track.
The track event is sent to the RTCPeerConnection when a new track has been added to the connection. By the time the track event is delivered to the RTCPeerConnection's ontrack handler, the new media has completed its negotiation for a specific RTCRtpReceiver (which is specified by the event's receiver property).
In addition, the MediaStreamTrack specified by the receiver's track is the same one specified by the event's track, and the track has been added to any associated remote MediaStream objects.
You can add a track event listener to be notified when the new track is available so that you can, for example, attach its media to a <video> element, using either RTCPeerConnection.addEventListener() or the ontrack event handler property.
Note: It may be helpful to keep in mind that you receive the track event when a new inbound track has been added to your connection, and you call addTrack() to add a track to the far end of the connection, thereby triggering a track event on the remote peer.
Example
This simple example creates an event listener for the track event which sets the srcObject of the <video> element with the ID videobox to the first stream in the list passed in the event's streams array.