1.10.0 (May 30, 2018)
New Features
-
A RemoteParticipant now maintains a collection of RemoteTrackPublications in a
new.trackPublications
property. It also maintains kind-specific
RemoteTrackPublication collections (.audioTrackPublications
,
.dataTrackPublications
and.videoTrackPublications
). A "trackPublished"
event is emitted on the RemoteParticipant (and subsequently on the Room) whenever
a Track is published. A "trackUnpublished" event is emitted on the RemoteParticipant
whenever a Track is unpublished. (JSDK-1438)participant.on('trackPublished', publication => { console.log('A new Track was published!', publication); assert.equal(participant.trackPublications.get(publication.trackSid), publication); }); participant.on('trackUnpublished', publication => { console.log('A new Track was unpublished!', publication); assert(!participant.trackPublications.has(publication.trackSid)); });
-
Added
trackSid
to TrackStats, so now, when you callgetStats
on a Room,
the TrackStats will include Track SIDs for local and remote Tracks.
(JSDK-1716)
Bug Fixes
- Fixed a bug that cause
remoteAudioTrackStats
andremoteVideoTrackStats
to
always be empty Arrays in Firefox. (JSDK-1927) - LogLevel was accidentally omitted from the API docs. (JSDK-1701)
RemoteTrackPublication Guide
A RemoteTrackPublication represents a Track that was published to the Room by
a RemoteParticipant.
publication.on('subscribed', track => {
console.log('Subscribed to Track', track);
assert.equal(publication.isSubscribed, true);
assert.equal(publication.track, track);
});
publication.on('subscriptionFailed', error => {
console.error('Subscription failed', error);
assert.equal(publication.isSubscribed, false);
assert.equal(publication.track, null);
});
publication.on('trackDisabled', () => {
console.log('Track disabled');
assert.equal(publication.isTrackEnabled, false);
});
publication.on('trackEnabled', () => {
console.log('Track enabled');
assert.equal(publication.isTrackEnabled, true);
});
publication.on('unsubscribed', track => {
console.log('Unsubscribed from Track', track);
assert.equal(publication.isSubscribed, false);
assert.equal(publication.track, null);
});