github twilio/twilio-video.js 1.5.0

1.5.0 (October 9, 2017)

New Features

  • You can now specify Track names. Refer to the Track name guide below for more

Bug Fixes

  • Fixed bug where RemoteTrack's "unsubscribed" event and RemoteParticipant's
    "trackUnsubscribed" event fired before the RemoteTrack was removed from the
    RemoteParticipant's tracks collections instead of after.

Track Name Guide

Setting Track names

There are a few different ways you can specify Track names. For example, you can
specify name as an audio or video constraint when calling any of
createLocalTracks, createLocalAudioTrack, createLocalVideoTrack, or

  audio: { name: 'microphone' },
  video: { name: 'camera' }

createLocalAudioTrack({ name: 'microphone' });
createLocalVideoTrack({ name: 'camera' });

connect(token, {
  audio: { name: 'microphone' },
  video: { name: 'camera' }

These will create a LocalAudioTrack and a LocalVideoTrack with the names
"microphone" and "camera", respectively. If you have a reference to a
MediaStreamTrack, you can also pass the name to the LocalAudioTrack or
LocalVideoTrack constructor:

const localAudioTrack = new LocalAudioTrack(mediaStreamTrack1, { name: 'microphone' });
const localVideoTrack = new LocalVideoTrack(mediaStreamTrack2, { name: 'camera' });

Similarly, for LocalDataTracks:

const localDataTrack = new LocalDataTrack({ name: 'data' });

You can even pass these values if you use the MediaStreamTrack override for
publishTrack. For example:

room.localParticipant.publishTrack(mediaStreamTrack, { name: 'my-track' });

Please keep in mind:

  • If you do not specify a Track name, the Track's name will default to the
    LocalTrack ID.
  • A single Participant cannot have two Tracks published with the same name at a

Getting Track names

You can check a LocalTrack or RemoteTrack's name by querying it's name
property. For example,

participant.on('trackSubscribed', track => {
  console.log('Subscribed to Track "' + + '"');

This can be useful, for example, for distinguishing between a RemoteVideoTrack
named "camera" and a RemoteVideoTrack named "screenshare".

latest releases: 2.13.0-rc5, 2.13.0-rc4, 2.13.0-rc3...
3 years ago