Package org.red5.codec

Examples of org.red5.codec.IVideoStreamCodec


  public boolean roomJoin(IClient client, IScope room) {
    log.debug("roomJoin : ");
   
    try {
     
      IConnection conn = Red5.getConnectionLocal();
      IServiceCapableConnection service = (IServiceCapableConnection) conn;
      String streamId = client.getId();
     
      log.debug("### Client connected to OpenMeetings, register Client StreamId: "
          + streamId + " scope "+ room.getName() );
     
      //Set StreamId in Client
      service.invoke("setId", new Object[] { streamId },this);

      String swfURL = "";
      if (conn.getConnectParams().get("swfUrl") != null) {
        swfURL = conn.getConnectParams().get("swfUrl").toString();
      }
     
      RoomClient rcm = this.clientListManager.addClientListItem(streamId, room.getName(), conn.getRemotePort(),
          conn.getRemoteAddress(), swfURL);
     
      //Log the User
      ConferenceLogDaoImpl.getInstance().addConferenceLog("ClientConnect", rcm.getUser_id(),
          streamId, null, rcm.getUserip(), rcm.getScope(),
          rcm.getExternalUserId(), rcm.getExternalUserType(),
View Full Code Here


  }
 
  public synchronized Map screenSharerAction(Map map) {
    try {
     
      IConnection current = Red5.getConnectionLocal();
      IServiceCapableConnection service = (IServiceCapableConnection) current;
     
      RoomClient currentClient = this.clientListManager.getClientByStreamId(current.getClient().getId());
     
      Map returnMap = new HashMap();
      returnMap.put("result", "stopAll");
     
     
      log.debug("-----------  ");
     
      if (currentClient != null) {
       
        boolean stopStreaming = Boolean.valueOf(map.get("stopStreaming").toString());
        boolean stopRecording = Boolean.valueOf(map.get("stopRecording").toString());
       
       
        if (stopStreaming) {
         
          log.debug("start streamPublishStart Is Screen Sharing -- Stop ");
         
          //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("stopRed5ScreenSharing",new Object[] { currentClient }, this);
                      log.debug("send Notification to");
                    }
                  }
                }
              }
            }
          }
         
          if (currentClient.isStartRecording()) {
           
            returnMap.put("result", "stopSharingOnly");
           
          }
         
          currentClient.setStartStreaming(false);
          currentClient.setScreenPublishStarted(false);
         
          this.clientListManager.updateClientByStreamId(currentClient.getStreamid(), currentClient);
         
        }
       
        if (stopRecording) {
         
          if (currentClient.isStartStreaming()) {
            returnMap.put("result", "stopRecordingOnly");
          }
         
          //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("stopRecordingMessage",new Object[] { currentClient }, this);
                      log.debug("send Notification to");
                    }
                  }
                }
              }
            }
          }
         
          this.flvRecorderService.stopRecordAndSave(current.getScope(), currentClient, null);
         
          currentClient.setStartRecording(false);
          currentClient.setIsRecording(false);
         
          this.clientListManager.updateClientByStreamId(currentClient.getStreamid(), currentClient);
View Full Code Here

    return null;
  }
 
  public List<RoomClient> checkRed5ScreenSharing() {
    try {
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
     
      log.debug("checkScreenSharing -2- "+streamid);
     
      List<RoomClient> screenSharerList = new LinkedList<RoomClient>();
     
View Full Code Here

  }
 
  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

TOP

Related Classes of org.red5.codec.IVideoStreamCodec

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.