Package com.mux.sdk.webrtc.spaces
Class Space
- java.lang.Object
-
- com.mux.sdk.webrtc.spaces.Space
-
public class Space extends java.lang.ObjectA 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 classSpace.AcrScorestatic interfaceSpace.AcrScoreSubmissionCallbackCallback for success/failure of submitting an ACR score.static classSpace.BroadcastStatestatic classSpace.Errorsstatic interfaceSpace.ListenerThe 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 voiddisconnect()Disconnect from the Spacejava.lang.StringgetConnectionId()java.lang.StringgetId()Retrieve the ID of this spaceLocalParticipantgetLocalParticipant()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.ParticipantgetParticipant(java.lang.String participantId)Retrieve the participant by ID Safe to access from the UI threadjava.lang.StringgetParticipantId()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 threadvoidjoin(Space.Listener listener)Join the Space with the provided (mandatory) Listener.voidleave(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.voidsubmitAcrScore(Space.AcrScore acrScore, Space.AcrScoreSubmissionCallback callback)java.lang.StringtoString()
-
-
-
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:
toStringin 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)
-
-