Package com.mux.sdk.webrtc.spaces
Class Space
- java.lang.Object
-
- com.mux.sdk.webrtc.spaces.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Space.AcrScore
static interface
Space.AcrScoreSubmissionCallback
Callback for success/failure of submitting an ACR score.static class
Space.BroadcastState
static class
Space.Errors
static interface
Space.Listener
The Listener interface is the way applications receive information about events occurring in a Space.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disconnect()
Disconnect from the Spacejava.lang.String
getConnectionId()
java.lang.String
getId()
Retrieve the ID of this spaceLocalParticipant
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.Participant
getParticipant(java.lang.String participantId)
Retrieve the participant by ID Safe to access from the UI threadjava.lang.String
getParticipantId()
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 threadvoid
join(Space.Listener listener)
Join the Space with the provided (mandatory) Listener.void
leave(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.void
submitAcrScore(Space.AcrScore acrScore, Space.AcrScoreSubmissionCallback callback)
java.lang.String
toString()
-
-
-
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 classjava.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()
-
submitAcrScore
public void submitAcrScore(Space.AcrScore acrScore, Space.AcrScoreSubmissionCallback callback)
-
-