Class LocalParticipant

  • All Implemented Interfaces:
    Participant

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

      • getSid

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

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

        @NonNull
        public java.lang.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.
      • getLocalAudioTracks

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

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

        @NonNull
        public java.util.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.