Class: LocalParticipant

LocalParticipant

A LocalParticipant represents the local Client in a Room.

Extends

Methods


addTrack(track)

Adds a MediaStreamTrack to the LocalParticipant.

Parameters:
Name Type Description
track MediaStreamTrack

The MediaStreamTrack to be added

Fires:
Throws:
TypeError
Returns:
  • The corresponding LocalTrack if added, null if already present
Type
LocalTrack

addTrack(track)

Adds a LocalTrack to the LocalParticipant.

Parameters:
Name Type Description
track LocalTrack

The LocalTrack to be added

Fires:
Throws:
TypeError
Returns:
  • The LocalTrack if added, null if already present
Type
LocalTrack

addTracks(tracks)

Adds multiple MediaStreamTracks to the LocalParticipant.

Parameters:
Name Type Description
tracks Array.<MediaStreamTrack>

The MediaStreamTracks to be added

Fires:
Throws:
TypeError
Returns:
  • The corresponding LocalTracks that were successfully added; If the LocalParticipant already has a corresponding LocalTrack for a MediaStreamTrack, it won't be included in the Array
Type
Array.<LocalTrack>

addTracks(tracks)

Adds multiple LocalTracks to the LocalParticipant.

Parameters:
Name Type Description
tracks Array.<LocalTrack>

The LocalTracks to be added

Fires:
Throws:
TypeError
Returns:
Type
Array.<LocalTrack>

removeTrack(track [, stop])

Removes a MediaStreamTrack from the LocalParticipant.

Parameters:
Name Type Argument Default Description
track MediaStreamTrack

The MediaStreamTrack to be removed

stop boolean <optional>
<nullable>
true

Whether or not to call LocalTrack#stop

Fires:
Throws:
TypeError
Returns:
  • The corresponding LocalTrack if removed, null if the corresponding LocalTrack for MediaStreamTrack doesn't exist
Type
LocalTrack

removeTrack(track [, stop])

Removes a LocalTrack from the LocalParticipant.

Parameters:
Name Type Argument Default Description
track LocalTrack

The LocalTrack to be removed

stop boolean <optional>
<nullable>
true

Whether or not to call LocalTrack#stop

Fires:
Throws:
TypeError
Returns:
Type
LocalTrack

removeTracks(tracks)

Removes multiple LocalTracks from the LocalParticipant.

Parameters:
Name Type Description
tracks Array.<LocalTrack>

The LocalTracks to be removed

Fires:
Throws:
TypeError
Returns:
Type
Array.<LocalTrack>

removeTracks(tracks)

Removes multiple MediaStreamTracks from the LocalParticipant.

Parameters:
Name Type Description
tracks Array.<MediaStreamTrack>

The MediaStreamTracks to be removed

Fires:
Throws:
TypeError
Returns:
  • The corresponding LocalTracks that were successfully removed; If the LocalParticipant doesn't have the corresponding LocalTrack for a MediaStreamTrack that is to be removed, it won't be included in the Array
Type
Array.<LocalTrack>

Events


disconnected

The Participant has disconnected.

Parameters:
Name Type Description
participant Participant

The Participant that disconnected.

Inherited From:

trackAdded

A Track was added by the Participant.

Parameters:
Name Type Description
track Track

The Track that was added

Inherited From:

trackDimensionsChanged

One of the Participant's VideoTrack's dimensions changed.

Parameters:
Name Type Description
track VideoTrack

The VideoTrack whose dimensions changed

Inherited From:

trackDisabled

A Track was disabled by the Participant.

Parameters:
Name Type Description
track Track

The Track that was disabled

Inherited From:

trackEnabled

A Track was enabled by the Participant.

Parameters:
Name Type Description
track Track

The Track that was enabled

Inherited From:

trackRemoved

A Track was removed by the Participant.

Parameters:
Name Type Description
track Track

The Track that was removed

Inherited From:

trackStarted

One of the Participant's Tracks started.

Parameters:
Name Type Description
track Track

The Track that started

Inherited From:

trackStopped

One of the LocalParticipant's LocalTracks stopped, either because LocalTrack#stop was called or because the underlying MediaStreamTrack ended).

Parameters:
Name Type Description
track LocalTrack

The LocalTrack that stopped