public class RoomManager extends Object
| Constructor and Description |
|---|
RoomManager(RoomEventHandler roomEventHandler,
KurentoClientProvider kcProvider)
Provides an instance of the room manager by setting an event handler.
|
RoomManager(UserNotificationService notificationService,
KurentoClientProvider kcProvider)
Provides an instance of the room manager by setting an user notification
service that will be used by the default event handler to send responses
and notifications back to the clients.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMediaElement(String participantId,
org.kurento.client.MediaElement element)
Applies a media element (filter, recorder, etc.) to media that is
currently streaming or that might get streamed sometime in the future.
|
void |
close()
Closes all resources.
|
void |
closeRoom(String roomName)
Closes an existing room by releasing all resources that were allocated
for the room.
|
boolean |
createRoom(String roomName)
Creates a room if it doesn’t already exist.
|
void |
evictParticipant(String participantId)
Method that tries to remove a participant from her room.
|
Set<UserParticipant> |
getParticipants(String roomName)
Returns all the participants inside a room.
|
Set<UserParticipant> |
getPeerPublishers(String participantId)
Returns the peer’s publishers (participants from which the peer is
receiving media).
|
Set<UserParticipant> |
getPeerSubscribers(String participantId)
Returns the peer’s subscribers (participants towards the peer is
streaming media).
|
org.kurento.client.MediaPipeline |
getPipeline(String participantId)
Returns the media pipeline used by the participant.
|
Set<UserParticipant> |
getPublishers(String roomName)
Returns all the publishers (participants streaming their media) inside a
room.
|
Set<String> |
getRooms()
Returns all currently active (opened) rooms.
|
Set<UserParticipant> |
getSubscribers(String roomName)
Returns all the subscribers (participants subscribed to a least one
stream of another user) inside a room.
|
void |
joinRoom(String userName,
String roomName,
ParticipantRequest request)
Represents a client’s request to join a room.
|
void |
leaveRoom(ParticipantRequest request)
Represents a client’s notification that she’s leaving the room.
|
void |
onIceCandidate(String endpointName,
String candidate,
int sdpMLineIndex,
String sdpMid,
ParticipantRequest request)
Request that carries info about an ICE candidate gathered on the client
side.
|
void |
publishMedia(ParticipantRequest request,
String sdpOffer,
boolean doLoopback,
org.kurento.client.MediaElement... mediaElements)
Represents a client’s request to start streaming her local media to
anyone inside the room.
|
void |
removeMediaElement(String participantId,
org.kurento.client.MediaElement element)
Disconnects and removes media element (filter, recorder, etc.) from a
media stream.
|
void |
sendMessage(String message,
String userName,
String roomName,
ParticipantRequest request)
Used by clients to send written messages to all other participants in the
room.
Side effects: The room event handler should acknowledge the client’s request by sending an empty message. |
void |
subscribe(String remoteName,
String sdpOffer,
ParticipantRequest request)
Represents a client’s request to receive media from room participants
that published their media.
|
void |
unpublishMedia(ParticipantRequest request)
Represents a client’s request to stop publishing her media stream.
|
void |
unsubscribe(String remoteName,
ParticipantRequest request)
Represents a client’s request to stop receiving media from the remote
peer.
|
public RoomManager(UserNotificationService notificationService, KurentoClientProvider kcProvider)
notificationService - encapsulates the communication layer, used to
instantiate DefaultRoomEventHandlerkcProvider - enables the manager to obtain Kurento Client instancespublic RoomManager(RoomEventHandler roomEventHandler, KurentoClientProvider kcProvider)
roomEventHandler - the room event handler implementationkcProvider - enables the manager to obtain Kurento Client instancespublic void joinRoom(String userName, String roomName, ParticipantRequest request)
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 roomrequest - instance of ParticipantRequest POJO containing the
participant’s id and a request id (optional identifier of the
request at the communications level, included when responding back
to the client)public void leaveRoom(ParticipantRequest request)
request - instance of ParticipantRequest POJOpublic void publishMedia(ParticipantRequest request, String sdpOffer, boolean doLoopback, org.kurento.client.MediaElement... mediaElements)
request - instance of ParticipantRequest POJOsdpOffer - SDP offer String generated by the client’s WebRTC peerdoLoopback - loopback flagmediaElements - variable array of media elements (filters,
recorders, etc.) that are connected between the source WebRTC
endpoint and the subscriber endpointspublic void unpublishMedia(ParticipantRequest request)
request - instance of ParticipantRequest POJOpublic void subscribe(String remoteName, String sdpOffer, ParticipantRequest request)
remoteName - identification of the remote stream which is
effectively the peer’s name (participant)sdpOffer - SDP offer String generated by the client’s WebRTC peerrequest - instance of ParticipantRequest POJOpublic void unsubscribe(String remoteName, ParticipantRequest request)
remoteName - identification of the remote stream which is
effectively the peer’s name (participant)request - instance of ParticipantRequest POJOpublic void sendMessage(String message, String userName, String roomName, ParticipantRequest request)
message - message contentsuserName - name or identifier of the user in the roomroomName - room’s namerequest - instance of ParticipantRequest POJOpublic void onIceCandidate(String endpointName, String candidate, int sdpMLineIndex, String sdpMid, ParticipantRequest request)
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 withrequest - instance of ParticipantRequest POJO@PreDestroy public void close()
closeRoom(String)public void evictParticipant(String participantId) throws AdminException
RoomEventHandler.onRoomClosed(String, Set) method will be called.participantId - identifier of the participantAdminException - in case that no participant exists with the given
id or it was impossible to perform the operationpublic Set<String> getRooms()
public Set<UserParticipant> getParticipants(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 Set<UserParticipant> getPublishers(String roomName) throws AdminException
roomName - name or identifier of the roomUserParticipant POJOS representing the existing
publishersAdminException - in case the room doesn’t existpublic Set<UserParticipant> getSubscribers(String roomName) throws AdminException
roomName - name or identifier of the roomUserParticipant POJOS representing the existing
subscribersAdminException - in case the room doesn’t existpublic Set<UserParticipant> getPeerPublishers(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 Set<UserParticipant> getPeerSubscribers(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 createRoom(String roomName) throws AdminException
roomName - name or identifier of the roomAdminException - in case there was a problem obtaining the required
instance of the Kurento Clientpublic org.kurento.client.MediaPipeline getPipeline(String participantId) throws AdminException
participantId - identifier of the participantAdminException - in case the participant doesn’t existpublic void closeRoom(String roomName) throws AdminException
roomName - name or identifier of the roomAdminException - in case the room doesn’t exist or has been already
closedpublic void addMediaElement(String participantId, org.kurento.client.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 removeMediaElement(String participantId, org.kurento.client.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 filterCopyright © 2015 Kurento. All rights reserved.