public class SyncRoomManager
extends java.lang.Object
Constructor and Description |
---|
SyncRoomManager(RoomHandler roomHandler,
KurentoClientProvider kcProvider)
Provides an instance of the room manager by setting a room handler and
the
KurentoClient provider. |
Modifier and Type | Method and Description |
---|---|
void |
addMediaElement(java.lang.String participantId,
MediaElement element)
Applies a media element (filter, recorder, mixer, etc.) to media that is
currently streaming or that might get streamed sometime in the future.
|
void |
addMediaElement(java.lang.String participantId,
MediaElement element,
MediaType type)
Applies a media element (filter, recorder, mixer, etc.) to media that is
currently streaming or that might get streamed sometime in the future.
|
void |
close()
Closes all resources.
|
void |
closeRoom(java.lang.String roomName)
Closes an existing room by releasing all resources that were allocated
for the room.
|
void |
createRoom(KurentoClientSessionInfo sessionInfo)
Creates a room if it doesn’t already exist.
|
java.lang.String |
generatePublishOffer(java.lang.String participantId)
Represents a client’s request to initiate the media connection from the
server-side (generate the SDP offer and send it back to the client) and
must be followed by processing the SDP answer from the client in order to
establish the streaming.
|
java.util.Set<UserParticipant> |
getParticipants(java.lang.String roomName)
Returns all the participants inside a room.
|
java.util.Set<UserParticipant> |
getPeerPublishers(java.lang.String participantId)
Returns the peer’s publishers (participants from which the peer is
receiving media).
|
java.util.Set<UserParticipant> |
getPeerSubscribers(java.lang.String participantId)
Returns the peer’s subscribers (participants towards the peer is
streaming media).
|
MediaPipeline |
getPipeline(java.lang.String participantId)
Returns the media pipeline used by the participant.
|
java.util.Set<UserParticipant> |
getPublishers(java.lang.String roomName)
Returns all the publishers (participants streaming their media) inside a
room.
|
java.util.Set<java.lang.String> |
getRooms()
Returns all currently active (opened) rooms.
|
java.util.Set<UserParticipant> |
getSubscribers(java.lang.String roomName)
Returns all the subscribers (participants subscribed to a least one
stream of another user) inside a room.
|
boolean |
isPublisherStreaming(java.lang.String participantId)
Checks if a participant is currently streaming media.
|
java.util.Set<UserParticipant> |
joinRoom(java.lang.String userName,
java.lang.String roomName,
boolean webParticipant,
java.lang.String participantId)
Represents a client’s request to join a room.
|
java.util.Set<UserParticipant> |
leaveRoom(java.lang.String participantId)
Represents a client’s notification that she’s leaving the room.
|
void |
mutePublishedMedia(MutedMediaType muteType,
java.lang.String participantId)
Mutes the streamed media of this publisher in a selective manner.
|
void |
muteSubscribedMedia(java.lang.String remoteName,
MutedMediaType muteType,
java.lang.String participantId)
Mutes the incoming media stream from the remote publisher in a selective
manner.
|
void |
onIceCandidate(java.lang.String endpointName,
java.lang.String candidate,
int sdpMLineIndex,
java.lang.String sdpMid,
java.lang.String participantId)
Request that carries info about an ICE candidate gathered on the client
side.
|
java.lang.String |
publishMedia(java.lang.String participantId,
boolean isOffer,
java.lang.String sdp,
boolean doLoopback,
MediaElement... mediaElements)
Same as
{@link #publishMedia(String, boolean, String, MediaElement, MediaType, boolean, MediaElement
|
java.lang.String |
publishMedia(java.lang.String participantId,
boolean isOffer,
java.lang.String sdp,
MediaElement loopbackAlternativeSrc,
MediaType loopbackConnectionType,
boolean doLoopback,
MediaElement... mediaElements)
Represents a client’s request to start streaming her local media to
anyone inside the room.
|
java.lang.String |
publishMedia(java.lang.String participantId,
boolean isOffer,
java.lang.String sdp,
MediaType loopbackConnectionType,
boolean doLoopback,
MediaElement... mediaElements)
Same as
{@link #publishMedia(String, boolean, String, MediaElement, MediaType, boolean, MediaElement
|
void |
removeMediaElement(java.lang.String participantId,
MediaElement element)
Disconnects and removes media element (filter, recorder, etc.) from a
media stream.
|
java.lang.String |
subscribe(java.lang.String remoteName,
java.lang.String sdpOffer,
java.lang.String participantId)
Represents a client’s request to receive media from room participants
that published their media.
|
void |
unmutePublishedMedia(java.lang.String participantId)
Reverts the effects of the mute operation.
|
void |
unmuteSubscribedMedia(java.lang.String remoteName,
java.lang.String participantId)
Reverts any previous mute operation.
|
void |
unpublishMedia(java.lang.String participantId)
Represents a client’s request to stop publishing her media stream.
|
void |
unsubscribe(java.lang.String remoteName,
java.lang.String participantId)
Represents a client’s request to stop receiving media from the remote
peer.
|
public SyncRoomManager(RoomHandler roomHandler, KurentoClientProvider kcProvider)
KurentoClient
provider.roomHandler
- the room handler implementationkcProvider
- enables the manager to obtain Kurento Client instancespublic java.util.Set<UserParticipant> joinRoom(java.lang.String userName, java.lang.String roomName, boolean webParticipant, java.lang.String participantId) throws AdminException
userName
- name or identifier of the user in the room. Will be used
to identify her WebRTC media peer (from the client-side).roomName
- name or identifier of the roomwebParticipant
- if true, the internal media
endpoints will use the trickle ICE mechanism when establishing
connections with external media peers (WebRtcEndpoint
); if
false, the media endpoints will be of type
RtpEndpoint
, with no ICE implementationparticipantId
- identifier of the participantUserParticipant
, can be
empty if firstAdminException
- on error while joining (like the room is not found
or is closing)public java.util.Set<UserParticipant> leaveRoom(java.lang.String participantId) throws AdminException
participantId
- identifier of the participantUserParticipant
, if empty
this method has closed the roomAdminException
- on error leaving the roompublic java.lang.String publishMedia(java.lang.String participantId, boolean isOffer, java.lang.String sdp, MediaElement loopbackAlternativeSrc, MediaType loopbackConnectionType, boolean doLoopback, MediaElement... mediaElements) throws AdminException
participantId
- identifier of the participantisOffer
- if true, the sdp is an offer from remote, otherwise is the
answer to the offer generated previously by the server endpointsdp
- SDP String offer or answer,
that's been generated by the client’s WebRTC peerloopbackAlternativeSrc
- instead of connecting the endpoint to
itself, use this MediaElement
as sourceloopbackConnectionType
- the connection type for the loopback; if
null, will stream both audio and video mediadoLoopback
- loopback flagmediaElements
- variable array of media elements (filters,
recorders, etc.) that are connected between the source WebRTC
endpoint and the subscriber endpointsAdminException
- on errorpublic java.lang.String publishMedia(java.lang.String participantId, boolean isOffer, java.lang.String sdp, boolean doLoopback, MediaElement... mediaElements) throws AdminException
publishMedia(String, boolean, String, MediaElement, MediaType, boolean, MediaElement...)
, using as loopback the published stream and no specific type of loopback
connection.AdminException
#publishMedia(String, boolean, String, boolean, MediaElement,
MediaElement...)
public java.lang.String publishMedia(java.lang.String participantId, boolean isOffer, java.lang.String sdp, MediaType loopbackConnectionType, boolean doLoopback, MediaElement... mediaElements) throws AdminException
publishMedia(String, boolean, String, MediaElement, MediaType, boolean, MediaElement...)
, using as loopback the published stream and allowing a specific
connection type.AdminException
#publishMedia(String, boolean, String, boolean, MediaElement,
MediaElement...)
public java.lang.String generatePublishOffer(java.lang.String participantId) throws AdminException
participantId
- identifier of the participantAdminException
- on error#publishMedia(String, String, boolean, MediaElement...)
public void unpublishMedia(java.lang.String participantId) throws AdminException
participantId
- identifier of the participantAdminException
- on errorpublic java.lang.String subscribe(java.lang.String remoteName, java.lang.String sdpOffer, java.lang.String participantId) throws AdminException
remoteName
- identification of the remote stream which is
effectively the peer’s name (participant)sdpOffer
- SDP offer String generated by the client’s WebRTC peerparticipantId
- identifier of the participantAdminException
- on errorpublic void unsubscribe(java.lang.String remoteName, java.lang.String participantId) throws AdminException
remoteName
- identification of the remote stream which is
effectively the peer’s name (participant)participantId
- identifier of the participantAdminException
- on errorpublic void onIceCandidate(java.lang.String endpointName, java.lang.String candidate, int sdpMLineIndex, java.lang.String sdpMid, java.lang.String participantId) throws AdminException
endpointName
- the name of the peer whose ICE candidate was gatheredcandidate
- the candidate attribute informationsdpMLineIndex
- the index (starting at zero) of the m-line in the
SDP this candidate is associated withsdpMid
- media stream identification, "audio" or "video", for the
m-line this candidate is associated withparticipantId
- identifier of the participantAdminException
- on errorpublic void addMediaElement(java.lang.String participantId, MediaElement element) throws AdminException
participantId
- identifier of the owner of the streamelement
- media element to be addedAdminException
- in case the participant doesn’t exist, has been
closed or on error when applying the filterpublic void addMediaElement(java.lang.String participantId, MediaElement element, MediaType type) throws AdminException
participantId
- identifier of the owner of the streamelement
- media element to be addedtype
- the connection type (null is accepted, has the same result as
calling addMediaElement(String, MediaElement)
)AdminException
- in case the participant doesn’t exist, has been
closed or on error when applying the filterpublic void removeMediaElement(java.lang.String participantId, MediaElement element) throws AdminException
participantId
- identifier of the participantelement
- media element to be removedAdminException
- in case the participant doesn’t exist, has been
closed or on error when removing the filterpublic void mutePublishedMedia(MutedMediaType muteType, java.lang.String participantId) throws AdminException
muteType
- which leg should be disconnected (audio, video or both)participantId
- identifier of the participantAdminException
- in case the participant doesn’t exist, has been
closed, is not publishing or on error when performing the mute
operationpublic void unmutePublishedMedia(java.lang.String participantId) throws AdminException
participantId
- identifier of the participantAdminException
- in case the participant doesn’t exist, has been
closed, is not publishing or on error when reverting the mute
operationpublic void muteSubscribedMedia(java.lang.String remoteName, MutedMediaType muteType, java.lang.String participantId) throws AdminException
remoteName
- identification of the remote stream which is
effectively the peer’s name (participant)muteType
- which leg should be disconnected (audio, video or both)participantId
- identifier of the participantAdminException
- in case the participant doesn’t exist, has been
closed, is not publishing or on error when performing the mute
operationpublic void unmuteSubscribedMedia(java.lang.String remoteName, java.lang.String participantId) throws AdminException
remoteName
- identification of the remote stream which is
effectively the peer’s name (participant)participantId
- identifier of the participantAdminException
- in case the participant doesn’t exist, has been
closed or on error when reverting the mute operation@PreDestroy public void close()
RoomManager.closeRoom(String)
public java.util.Set<java.lang.String> getRooms()
public java.util.Set<UserParticipant> getParticipants(java.lang.String roomName) throws AdminException
roomName
- name or identifier of the roomUserParticipant
POJOS (an instance contains the
participant’s identifier and her user name)AdminException
- in case the room doesn’t existpublic java.util.Set<UserParticipant> getPublishers(java.lang.String roomName) throws AdminException
roomName
- name or identifier of the roomUserParticipant
POJOS representing the existing
publishersAdminException
- in case the room doesn’t existpublic java.util.Set<UserParticipant> getSubscribers(java.lang.String roomName) throws AdminException
roomName
- name or identifier of the roomUserParticipant
POJOS representing the existing
subscribersAdminException
- in case the room doesn’t existpublic java.util.Set<UserParticipant> getPeerPublishers(java.lang.String participantId) throws AdminException
participantId
- identifier of the participantUserParticipant
POJOS representing the publishers
this participant is currently subscribed toAdminException
- in case the participant doesn’t existpublic java.util.Set<UserParticipant> getPeerSubscribers(java.lang.String participantId) throws AdminException
participantId
- identifier of the participantUserParticipant
POJOS representing the
participants subscribed to this peerAdminException
- in case the participant doesn’t existpublic boolean isPublisherStreaming(java.lang.String participantId) throws AdminException
participantId
- identifier of the participantAdminException
- in case the participant doesn’t exist or has been
closedpublic void createRoom(KurentoClientSessionInfo sessionInfo) throws AdminException
sessionInfo
- bean that will be passed to the
KurentoClientProvider
in order to obtain the
KurentoClient
that will be used by the roomAdminException
- in case of error while creating the roompublic void closeRoom(java.lang.String roomName) throws AdminException
roomName
- name or identifier of the roomAdminException
- in case the room doesn’t exist or has been already
closedpublic MediaPipeline getPipeline(java.lang.String participantId) throws AdminException
participantId
- identifier of the participantAdminException
- in case the participant doesn’t exist