public class RoomManager extends Object
| Constructor and Description |
|---|
RoomManager(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(String participantId,
org.kurento.client.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(String participantId,
org.kurento.client.MediaElement element,
org.kurento.client.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.
|
Set<UserParticipant> |
closeRoom(String roomName)
Closes an existing room by releasing all resources that were allocated
for the room.
|
void |
createRoom(KurentoClientSessionInfo kcSessionInfo)
Creates a room if it doesn't already exist.
|
String |
generatePublishOffer(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.
|
UserParticipant |
getParticipantInfo(String participantId)
Searches for the participant using her identifier and returns the
corresponding
UserParticipant POJO. |
String |
getParticipantName(String participantId)
Finds the participant's username.
|
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.
|
String |
getRoomName(String participantId)
Finds the room's name of a given participant.
|
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.
|
boolean |
isClosed() |
boolean |
isPublisherStreaming(String participantId)
Checks if a participant is currently streaming media.
|
Set<UserParticipant> |
joinRoom(String userName,
String roomName,
boolean webParticipant,
KurentoClientSessionInfo kcSessionInfo,
String participantId)
Represents a client's request to join a room.
|
Set<UserParticipant> |
leaveRoom(String participantId)
Represents a client's notification that she's leaving the room.
|
void |
mutePublishedMedia(MutedMediaType muteType,
String participantId)
Mutes the streamed media of this publisher in a selective manner.
|
void |
muteSubscribedMedia(String remoteName,
MutedMediaType muteType,
String participantId)
Mutes the incoming media stream from the remote publisher in a selective
manner.
|
void |
onIceCandidate(String endpointName,
String candidate,
int sdpMLineIndex,
String sdpMid,
String participantId)
Request that carries info about an ICE candidate gathered on the client
side.
|
String |
publishMedia(String participantId,
boolean isOffer,
String sdp,
boolean doLoopback,
org.kurento.client.MediaElement... mediaElements)
Same as
publishMedia(String, boolean, String, MediaElement, MediaType, boolean, MediaElement...)
, using as loopback the published stream and no specific type of loopback
connection. |
String |
publishMedia(String participantId,
boolean isOffer,
String sdp,
org.kurento.client.MediaElement loopbackAlternativeSrc,
org.kurento.client.MediaType loopbackConnectionType,
boolean doLoopback,
org.kurento.client.MediaElement... mediaElements)
Represents a client's request to start streaming her local media to
anyone inside the room.
|
String |
publishMedia(String participantId,
String sdp,
boolean doLoopback,
org.kurento.client.MediaElement... mediaElements)
Same as
publishMedia(String, boolean, String, MediaElement, MediaType, boolean, MediaElement...)
where the sdp String is an offer generated by the remote peer, the
published stream will be used for loopback (if required) and no specific
type of loopback connection. |
void |
removeMediaElement(String participantId,
org.kurento.client.MediaElement element)
Disconnects and removes media element (filter, recorder, etc.) from a
media stream.
|
String |
subscribe(String remoteName,
String sdpOffer,
String participantId)
Represents a client's request to receive media from room participants
that published their media.
|
void |
unmutePublishedMedia(String participantId)
Reverts the effects of the mute operation.
|
void |
unmuteSubscribedMedia(String remoteName,
String participantId)
Reverts any previous mute operation.
|
void |
unpublishMedia(String participantId)
Represents a client's request to stop publishing her media stream.
|
void |
unsubscribe(String remoteName,
String participantId)
Represents a client's request to stop receiving media from the remote
peer.
|
public RoomManager(RoomHandler roomHandler, KurentoClientProvider kcProvider)
KurentoClient provider.roomHandler - the room handler implementationkcProvider - enables the manager to obtain Kurento Client instancespublic Set<UserParticipant> joinRoom(String userName, String roomName, boolean webParticipant, KurentoClientSessionInfo kcSessionInfo, String participantId) throws RoomException
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 endpoint will be a
RtpEndpoint, with no ICE implementationkcSessionInfo - sessionInfo bean to be used to create the room in case it
doesn't exist (if null, the room will not be created)participantId - identifier of the participantUserParticipant, can be
empty if firstRoomException - on error while joining (like the room is not found or is
closing)public Set<UserParticipant> leaveRoom(String participantId) throws RoomException
participantId - identifier of the participantUserParticipant, if empty
this method has closed the roomRoomException - on error leaving the roompublic String publishMedia(String participantId, boolean isOffer, String sdp, org.kurento.client.MediaElement loopbackAlternativeSrc, org.kurento.client.MediaType loopbackConnectionType, boolean doLoopback, org.kurento.client.MediaElement... mediaElements) throws RoomException
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 endpointsRoomException - on errorpublic String publishMedia(String participantId, String sdp, boolean doLoopback, org.kurento.client.MediaElement... mediaElements) throws RoomException
publishMedia(String, boolean, String, MediaElement, MediaType, boolean, MediaElement...)
where the sdp String is an offer generated by the remote peer, the
published stream will be used for loopback (if required) and no specific
type of loopback connection.RoomException#publishMedia(String, boolean, String, boolean, MediaElement,
MediaElement...)public String publishMedia(String participantId, boolean isOffer, String sdp, boolean doLoopback, org.kurento.client.MediaElement... mediaElements) throws RoomException
publishMedia(String, boolean, String, MediaElement, MediaType, boolean, MediaElement...)
, using as loopback the published stream and no specific type of loopback
connection.RoomException#publishMedia(String, boolean, String, boolean, MediaElement,
MediaElement...)public String generatePublishOffer(String participantId) throws RoomException
participantId - identifier of the participantRoomException - on errorpublishMedia(String, String, boolean, MediaElement...)public void unpublishMedia(String participantId) throws RoomException
participantId - identifier of the participantRoomException - on errorpublic String subscribe(String remoteName, String sdpOffer, String participantId) throws RoomException
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 participantRoomException - on errorpublic void unsubscribe(String remoteName, String participantId) throws RoomException
remoteName - identification of the remote stream which is effectively the
peer's name (participant)participantId - identifier of the participantRoomException - on errorpublic void onIceCandidate(String endpointName, String candidate, int sdpMLineIndex, String sdpMid, String participantId) throws RoomException
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 participantRoomException - on errorpublic void addMediaElement(String participantId, org.kurento.client.MediaElement element) throws RoomException
participantId - identifier of the owner of the streamelement - media element to be addedRoomException - in case the participant doesn't exist, has been closed or on
error when applying the filterpublic void addMediaElement(String participantId, org.kurento.client.MediaElement element, org.kurento.client.MediaType type) throws RoomException
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))RoomException - 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 RoomException
participantId - identifier of the participantelement - media element to be removedRoomException - in case the participant doesn't exist, has been closed or on
error when removing the filterpublic void mutePublishedMedia(MutedMediaType muteType, String participantId) throws RoomException
muteType - which leg should be disconnected (audio, video or both)participantId - identifier of the participantRoomException - in case the participant doesn't exist, has been closed, is
not publishing or on error when performing the mute operationpublic void unmutePublishedMedia(String participantId) throws RoomException
participantId - identifier of the participantRoomException - in case the participant doesn't exist, has been closed, is
not publishing or on error when reverting the mute operationpublic void muteSubscribedMedia(String remoteName, MutedMediaType muteType, String participantId) throws RoomException
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 participantRoomException - in case the participant doesn't exist, has been closed, is
not publishing or on error when performing the mute operationpublic void unmuteSubscribedMedia(String remoteName, String participantId) throws RoomException
remoteName - identification of the remote stream which is effectively the
peer's name (participant)participantId - identifier of the participantRoomException - in case the participant doesn't exist, has been closed or on
error when reverting the mute operation@PreDestroy public void close()
closeRoom(String)public boolean isClosed()
close() has been calledpublic Set<String> getRooms()
public Set<UserParticipant> getParticipants(String roomName) throws RoomException
roomName - name or identifier of the roomUserParticipant POJOS (an instance contains the
participant's identifier and her user name)RoomException - in case the room doesn't existpublic Set<UserParticipant> getPublishers(String roomName) throws RoomException
roomName - name or identifier of the roomUserParticipant POJOS representing the existing
publishersRoomException - in case the room doesn't existpublic Set<UserParticipant> getSubscribers(String roomName) throws RoomException
roomName - name or identifier of the roomUserParticipant POJOS representing the existing
subscribersRoomException - in case the room doesn't existpublic Set<UserParticipant> getPeerPublishers(String participantId) throws RoomException
participantId - identifier of the participantUserParticipant POJOS representing the publishers
this participant is currently subscribed toRoomException - in case the participant doesn't existpublic Set<UserParticipant> getPeerSubscribers(String participantId) throws RoomException
participantId - identifier of the participantUserParticipant POJOS representing the
participants subscribed to this peerRoomException - in case the participant doesn't existpublic boolean isPublisherStreaming(String participantId) throws RoomException
participantId - identifier of the participantRoomException - in case the participant doesn't exist or has been closedpublic void createRoom(KurentoClientSessionInfo kcSessionInfo) throws RoomException
kcSessionInfo - bean that will be passed to the KurentoClientProvider
in order to obtain the KurentoClient that will be used
by the roomRoomException - in case of error while creating the roompublic Set<UserParticipant> closeRoom(String roomName) throws RoomException
roomName - name or identifier of the roomUserParticipant POJOS representing the room's
participantsRoomException - in case the room doesn't exist or has been already closedpublic org.kurento.client.MediaPipeline getPipeline(String participantId) throws RoomException
participantId - identifier of the participantRoomException - in case the participant doesn't existpublic String getRoomName(String participantId) throws RoomException
participantId - identifier of the participantRoomException - in case the participant doesn't existpublic String getParticipantName(String participantId) throws RoomException
participantId - identifier of the participantRoomException - in case the participant doesn't existpublic UserParticipant getParticipantInfo(String participantId) throws RoomException
UserParticipant POJO.participantId - identifier of the participantUserParticipant POJO containing the participant's name
and identifierRoomException - in case the participant doesn't existCopyright © 2015 Kurento. All rights reserved.