Class Space


  • public class Space
    extends java.lang.Object
    A Space is where participants meet. Participants can publish their own tracks and subscribe to other publishers.

    A Space sends events to a Space.Listener as a way to relay state updates.
    • Method Detail

      • join

        public void join​(@NotNull
                         Space.Listener listener)
        Join the Space with the provided (mandatory) Listener.

        The Listener will receive events from the Space.
        Parameters:
        listener -
      • leave

        public void leave​(@NotNull
                          Space.Listener listener,
                          boolean keepSpaceActiveWithNoListeners)
        Leave the Space and unregister the given listener

        When there are no listeners in a Space the Space will disconnect unless the provided boolean is true. If it has been set then the Space will stay active for a short grace period to allow an opportunity for another listener to join. This facility is used in the getting started guide to simplify configuration change handling.
        Parameters:
        listener -
        keepSpaceActiveWithNoListeners -
      • getId

        public java.lang.String getId()
        Retrieve the ID of this space
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • disconnect

        public void disconnect()
        Disconnect from the Space
      • getConnectionId

        public java.lang.String getConnectionId()
      • getLocalParticipant

        public LocalParticipant getLocalParticipant()
        Get the local participant in this Space

        There is only one local participant in a Space, and it has the ability to publish and unpublish local tracks.

        This getter is provided so that you can access the local camera and microphone tracks before even joining a Space so things like previews can be implemented.
        Returns:
      • getParticipant

        public Participant getParticipant​(java.lang.String participantId)
        Retrieve the participant by ID Safe to access from the UI thread
        Parameters:
        participantId -
        Returns:
      • getParticipants

        public java.util.HashMap<java.lang.String,​Participant> getParticipants()
        Gets a map of all participants in the space, indexed by their IDs Safe to access from the UI thread
        Returns:
      • getParticipantId

        public java.lang.String getParticipantId()