Class LocalParticipant

java.lang.Object
com.twilio.video.LocalParticipant
All Implemented Interfaces:
Participant

public class LocalParticipant extends Object implements Participant
Represents the local participant of a Room you are connected to.
  • Method Details

    • getSid

      @NonNull public String getSid()
      Returns the SID of the local participant.
      Specified by:
      getSid in interface Participant
    • getIdentity

      @NonNull public String getIdentity()
      Returns the identity of the local participant.
      Specified by:
      getIdentity in interface Participant
    • getState

      @NonNull public Participant.State getState()
      Returns participant state.
      Specified by:
      getState in interface Participant
    • getNetworkQualityLevel

      @NonNull public NetworkQualityLevel getNetworkQualityLevel()
      Returns the LocalParticipant's Network Quality Level.
      Specified by:
      getNetworkQualityLevel in interface Participant
      See Also:
    • getSignalingRegion

      @NonNull public String getSignalingRegion()
      Where the LocalParticipant's signaling traffic enters and exits Twilio's communications cloud. This property reflects the region passed to ConnectOptions.Builder.region(String) and when `gll` (the default value) is provided, the region that was selected using latency based routing.
    • getAudioTracks

      @NonNull public List<AudioTrackPublication> getAudioTracks()
      Returns read-only list of audio track publications.
      Specified by:
      getAudioTracks in interface Participant
    • getVideoTracks

      @NonNull public List<VideoTrackPublication> getVideoTracks()
      Returns read-only list of video track publications.
      Specified by:
      getVideoTracks in interface Participant
    • getDataTracks

      @NonNull public List<DataTrackPublication> getDataTracks()
      Returns read-only list of data track publications.
      Specified by:
      getDataTracks in interface Participant
    • getLocalAudioTracks

      @NonNull public List<LocalAudioTrackPublication> getLocalAudioTracks()
      Returns read-only list of local audio track publications.
    • getLocalVideoTracks

      @NonNull public List<LocalVideoTrackPublication> getLocalVideoTracks()
      Returns read-only list of local video track publications.
    • getLocalDataTracks

      @NonNull public List<LocalDataTrackPublication> getLocalDataTracks()
      Returns read-only list of local data track publications.
    • publishTrack

      public boolean publishTrack(@NonNull LocalAudioTrack localAudioTrack)
      Shares audio track to all participants in a Room with default LocalTrackPublicationOptions.
      Parameters:
      localAudioTrack - the local audio track to publish
      Returns:
      true if the audio track published or false if the local participant is not connected or the track was already published.
    • publishTrack

      public boolean publishTrack(@NonNull LocalAudioTrack localAudioTrack, @NonNull LocalTrackPublicationOptions localTrackPublicationOptions)
      Shares audio track to all participants in a Room with the provided LocalTrackPublicationOptions.
      Parameters:
      localAudioTrack - the local audio track to publish
      localTrackPublicationOptions - the local track publication options used to publish the local audio track
      Returns:
      true if the audio track was published or false if the local participant is not connected or the track was already published.
    • publishTrack

      public boolean publishTrack(@NonNull LocalVideoTrack localVideoTrack)
      Shares video track to all participants in a Room with default LocalTrackPublicationOptions.
      Parameters:
      localVideoTrack - the local video track to publish
      Returns:
      true if the video track was published or false if the local participant is not connected or the track was already published.
    • publishTrack

      public boolean publishTrack(@NonNull LocalVideoTrack localVideoTrack, @NonNull LocalTrackPublicationOptions localTrackPublicationOptions)
      Shares video track to all participants in a Room with the provided LocalTrackPublicationOptions.
      Parameters:
      localVideoTrack - the local video track to publish
      localTrackPublicationOptions - the local track publication options used to publish the local video track
      Returns:
      true if the video track was published or false if the local participant is not connected or the track was already published.
    • publishTrack

      public boolean publishTrack(@NonNull LocalDataTrack localDataTrack)
      Shared data track to all participants in a Room with default LocalTrackPublicationOptions.
      Parameters:
      localDataTrack - the local data track to publish
      Returns:
      true if the data track was published or false if the local participant is not connected or the track was already published.
    • publishTrack

      public boolean publishTrack(@NonNull LocalDataTrack localDataTrack, @NonNull LocalTrackPublicationOptions localTrackPublicationOptions)
      Shared data track to all participants in a Room with the provided LocalTrackPublicationOptions.
      Parameters:
      localDataTrack - the local data track to publish
      localTrackPublicationOptions - the local track publication options used to publish the local data track
      Returns:
      true if the data track was published or false if the local participant is not connected or the track was already published.
    • unpublishTrack

      public boolean unpublishTrack(@NonNull LocalAudioTrack localAudioTrack)
      Stops the sharing of an audio track to all the participants in a Room.
      Returns:
      true if the audio track was unpublished or false if the local participant is not connected or could not unpublish audio track.
    • unpublishTrack

      public boolean unpublishTrack(@NonNull LocalVideoTrack localVideoTrack)
      Stops the sharing of a video track to all the participants in a Room.
      Returns:
      true if video track was unpublished or false if the local participant is not connected or could not unpublish video track.
    • unpublishTrack

      public boolean unpublishTrack(@NonNull LocalDataTrack localDataTrack)
      Stops the sharing of a data track to all the participants in a Room.
      Returns:
      true if the data track was unpublished or false if the local participant is not connected or could not unpublish the data track.
    • setListener

      public void setListener(@NonNull LocalParticipant.Listener listener)
      Set listener for local participant events.
      Parameters:
      listener - of local participant events.
    • setEncodingParameters

      public void setEncodingParameters(@Nullable EncodingParameters encodingParameters)
      Updates the EncodingParameters used to share media in the Room.
      Parameters:
      encodingParameters - The EncodingParameters to use or null for the default values.