Package org.red5.server.api

Examples of org.red5.server.api.IBWControllable


  }
 
  public synchronized Map setConnectionAsSharingClient(Map map) {
    try {
     
      IConnection current = Red5.getConnectionLocal();
      //IServiceCapableConnection service = (IServiceCapableConnection) current;
     
      log.debug("### setConnectionAsSharingClient: ");
     
      RoomClient currentClient = this.clientListManager.getClientByStreamId(current.getClient().getId());

      if (currentClient != null) {
       
        boolean startRecording = Boolean.valueOf(map.get("startRecording").toString());
        boolean startStreaming = Boolean.valueOf(map.get("startStreaming").toString());
       
        currentClient.setRoom_id(Long.parseLong(current.getScope().getName()));
       
        //Set this connection to be a RTMP-Java Client
        currentClient.setIsScreenClient(true);
        currentClient.setUser_id(Long.parseLong(map.get("user_id").toString()));
       
        if (startStreaming) {
          currentClient.setStartStreaming(true);
        }
       
        if (startRecording) {
          currentClient.setStartRecording(true);
        }
       
        currentClient.setOrganization_id(Long.parseLong(map.get("organization_id").toString()));
       
        this.clientListManager.updateClientByStreamId(current.getClient().getId(), currentClient);
       
        Map returnMap = new HashMap();
        returnMap.put("alreadyPublished", false);
       
        //if is already started screen sharing, then there is no need to start it again
        if (currentClient.getScreenPublishStarted() != null && currentClient.getScreenPublishStarted()) {
          returnMap.put("alreadyPublished", true);
        }
       
        currentClient.setVX(Integer.parseInt(map.get("screenX").toString()));
        currentClient.setVY(Integer.parseInt(map.get("screenY").toString()));
        currentClient.setVWidth(Integer.parseInt(map.get("screenWidth").toString()));
        currentClient.setVHeight(Integer.parseInt(map.get("screenHeight").toString()));
       
        log.debug("screen x,y,width,height "+currentClient.getVX()+" "+currentClient.getVY()+" "+currentClient.getVWidth()+" "+currentClient.getVHeight());
       
        log.debug("publishName :: "+map.get("publishName"));
       
        currentClient.setStreamPublishName(map.get("publishName").toString());
     
        RoomClient currentScreenUser = this.clientListManager.getClientByPublicSID(currentClient.getStreamPublishName());
       
        currentClient.setFirstname(currentScreenUser.getFirstname());
        currentClient.setLastname(currentScreenUser.getLastname());
       
        //This is duplicated, but its not sure that in the meantime somebody requests this Client Object Info
        this.clientListManager.updateClientByStreamId(current.getClient().getId(), currentClient);
       
        if (startStreaming) {
         
          returnMap.put("modus", "startStreaming");
         
          log.debug("start streamPublishStart Is Screen Sharing ");
         
          //Notify all users of the same Scope
          Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
          for (Set<IConnection> conset : conCollection) {
            for (IConnection conn : conset) {
              if (conn != null) {
                if (conn instanceof IServiceCapableConnection) {
                  if (conn.equals(current)){
                    continue;
                  } else {
                    RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId());
                    //log.debug("is this users still alive? :"+rcl);
                    //Check if the Client is in the same room and same domain
                    if (rcl == null) {
                      //continue;
                    } else if (rcl.getIsScreenClient() != null && rcl.getIsScreenClient()) {
                        //continue;
                      } else {
                      IServiceCapableConnection iStream = (IServiceCapableConnection) conn;
                      //log.info("IServiceCapableConnection ID " + iStream.getClient().getId());
                      iStream.invoke("newRed5ScreenSharing",new Object[] { currentClient }, this);
                      log.debug("send Notification to");
                    }
                  }
                }
              }
            }
          }
       
        }
       
        if (startRecording) {
         
          returnMap.put("modus", "startRecording");
         
          String recordingName = "Recording "+CalendarPatterns.getDateWithTimeByMiliSeconds(new Date());
         
          this.flvRecorderService.recordMeetingStream( recordingName, "" ,false);
         
        }
       
        return returnMap;
       
      } else {
        throw new Exception("Could not find Screen Sharing Client "+current.getClient().getId());
      }
     
    } catch (Exception err){
      log.error("[setConnectionAsSharingClient]",err);
   
View Full Code Here


  /**
   * this function is invoked directly after initial connecting
   * @return
   */
  public synchronized String getPublicSID() {
    IConnection current = Red5.getConnectionLocal();
    RoomClient currentClient = this.clientListManager.getClientByStreamId(current.getClient().getId());
    return currentClient.getPublicSID();
  }
View Full Code Here

   * this function is invoked after a reconnect
   * @param newPublicSID
   */
  public synchronized Boolean overwritePublicSID(String newPublicSID) {
    try {
      IConnection current = Red5.getConnectionLocal();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(current.getClient().getId());
      if (currentClient == null) {
        return false;
      }
      currentClient.setPublicSID(newPublicSID);
      this.clientListManager.updateClientByStreamId(current.getClient().getId(), currentClient);
      return true;
    } catch (Exception err) {
      log.error("[overwritePublicSID]",err);
    }
    return null;
View Full Code Here

   *
   */
  public synchronized void logicalRoomLeave() {
    log.debug("logicalRoomLeave ");
    try {
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
     
      log.debug(streamid + " is leaving");
     
      RoomClient currentClient = this.clientListManager.getClientByStreamId(streamid);
     
      this.roomLeaveByScope(currentClient, current.getScope());
     
    } catch (Exception err){
      log.error("[logicalRoomLeave]",err);
    }   
  } 
View Full Code Here

   *
   */
  public synchronized void streamPublishStart(IBroadcastStream stream) {
    try {

      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(streamid);
           
      // Notify all the clients that the stream had been started
      log.debug("start streamPublishStart broadcast start: "+ stream.getPublishedName() + "CONN " + current);
     
      //In case its a screen sharing we start a new Video for that
      if (currentClient.getIsScreenClient()) {
       
        currentClient.setScreenPublishStarted(true);
       
        this.clientListManager.updateClientByStreamId(current.getClient().getId(), currentClient);
       
      }

      //Notify all users of the same Scope
      //We need to iterate through the streams to cathc if anybody is recording
      Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
      for (Set<IConnection> conset : conCollection) {
        for (IConnection conn : conset) {
          if (conn != null) {
            if (conn instanceof IServiceCapableConnection) {
              if (conn.equals(current)){
View Full Code Here

   */ 
  private synchronized void sendClientBroadcastNotifications(IBroadcastStream stream,String clientFunction, RoomClient rc){
    try {

      // Store the local so that we do not send notification to ourself back
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(streamid);
       
      if (currentClient == null) {
       
        //In case the client has already left(kicked) this message might be thrown later then the RoomLeave
        //event and the currentClient is already gone
        //The second Use-Case where the currentClient is maybe null is if we remove the client because its a Zombie/Ghost
       
        return;
       
      }
      // Notify all the clients that the stream had been started
      log.debug("sendClientBroadcastNotifications: "+ stream.getPublishedName());
      log.debug("sendClientBroadcastNotifications : "+ currentClient+ " " + currentClient.getStreamid());
     
      //Notify all clients of the same scope (room)
      Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
      for (Set<IConnection> conset : conCollection) {
        for (IConnection conn : conset) {
          if (conn != null) {
            if (conn instanceof IServiceCapableConnection) {
              if (conn.equals(current)){
                //there is a Bug in the current implementation of the appDisconnect
                if (clientFunction.equals("closeStream")){
                  RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId());
                  if (clientFunction.equals("closeStream") && rcl.getIsRecording()){
                    log.debug("*** sendClientBroadcastNotifications Any Client is Recording - stop that");
                    //StreamService.stopRecordingShowForClient(conn, currentClient, rcl.getRoomRecordingName(), false);
                    this.flvRecorderService.stopRecordingShowForClient(conn, currentClient);
                  }
                  // Don't notify current client
                  current.ping();
                }
                continue;
              } else {
                RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId());
                if (rcl != null){
View Full Code Here

  public synchronized Long addModerator(String publicSID) {
    try {
     
      log.debug("*..*addModerator publicSID: " + publicSID);
     
      IConnection current = Red5.getConnectionLocal();
      //String streamid = current.getClient().getId();
     
      RoomClient currentClient = this.clientListManager.getClientByPublicSID(publicSID);
     
      if (currentClient == null) {
        return -1L;
      }
      Long room_id = currentClient.getRoom_id();
     
      currentClient.setIsMod(true);
      //Put the mod-flag to true for this client
      this.clientListManager.updateClientByStreamId(currentClient.getStreamid(), currentClient);
     
      List<RoomClient> currentMods = this.clientListManager.getCurrentModeratorByRoom(room_id);
     
      //Notify all clients of the same scope (room)
      Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
      for (Set<IConnection> conset : conCollection) {
        for (IConnection conn : conset) {
          if (conn != null) {
            RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId());
           
View Full Code Here

  }
 
  public void setNewCursorPosition(Object item) {
    try {
     
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(streamid);
     
      //log.debug("[setNewCursorPosition]"+item);
     
      Map cursor = (Map) item;
      cursor.put("streamPublishName",currentClient.getStreamPublishName());
     
      //log.debug("[setNewCursorPosition x]"+cursor.get("cursor_x"));
      //log.debug("[setNewCursorPosition y]"+cursor.get("cursor_y"));
      //log.debug("[setNewCursorPosition publicSID]"+cursor.get("publicSID"));
     
      //Notify all users of the same Scope
      Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
      for (Set<IConnection> conset : conCollection) {
        for (IConnection conn : conset) {
          if (conn != null) {
            if (conn instanceof IServiceCapableConnection) {
              if (conn.equals(current)){
View Full Code Here

  public synchronized Long removeModerator(String publicSID) {
    try {
     
      log.debug("*..*addModerator publicSID: " + publicSID);
     
      IConnection current = Red5.getConnectionLocal();
      //String streamid = current.getClient().getId();
     
      RoomClient currentClient = this.clientListManager.getClientByPublicSID(publicSID);
     
      if (currentClient == null) {
        return -1L;
      }
      Long room_id = currentClient.getRoom_id();
     
      currentClient.setIsMod(false);
      //Put the mod-flag to true for this client
      this.clientListManager.updateClientByStreamId(currentClient.getStreamid(), currentClient);
     
      List<RoomClient> currentMods = this.clientListManager.getCurrentModeratorByRoom(room_id);
     
      //Notify all clients of the same scope (room)
      Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
      for (Set<IConnection> conset : conCollection) {
        for (IConnection conn : conset) {
          if (conn != null) {
            RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId());
            if (rcl == null) {
View Full Code Here

  public synchronized Long setBroadCastingFlag(String publicSID, boolean value, Integer interviewPodId) {
    try {
     
      log.debug("*..*setBroadCastingFlag publicSID: " + publicSID);
     
      IConnection current = Red5.getConnectionLocal();
      //String streamid = current.getClient().getId();
     
      RoomClient currentClient = this.clientListManager.getClientByPublicSID(publicSID);
     
      if (currentClient == null) {
        return -1L;
      }
     
      currentClient.setIsBroadcasting(value);
      currentClient.setInterviewPodId(interviewPodId);
     
      //Put the mod-flag to true for this client
      this.clientListManager.updateClientByStreamId(currentClient.getStreamid(), currentClient);
     
      //Notify all clients of the same scope (room)
      Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
      for (Set<IConnection> conset : conCollection) {
        for (IConnection conn : conset) {
          if (conn != null) {
            RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId());
            if (rcl == null) {
View Full Code Here

TOP

Related Classes of org.red5.server.api.IBWControllable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.