Package org.red5.server.api

Examples of org.red5.server.api.IConnection


   */
  public synchronized Client setUsernameAndSession(String SID,
      Long userId, String username, String firstname, String lastname) {
    try {
      log.debug("-----------  setUsernameAndSession");
      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();
      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);

      currentClient.setUsername(username);
      currentClient.setUser_id(userId);
      SessionVariablesUtil.setUserId(current.getClient(), userId);
      currentClient.setUserObject(userId, username, firstname, lastname);

      // Update Session Data
      log.debug("UDPATE SESSION " + SID + ", " + userId);
      sessiondataDao.updateUserWithoutSession(SID, userId);
View Full Code Here


    return roomClientList;
  }

  public synchronized List<Client> getCurrentModeratorList() {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);
      Long room_id = currentClient.getRoom_id();
      return this.sessionManager.getCurrentModeratorByRoom(room_id);
    } catch (Exception err) {
      log.error("[getCurrentModerator]", err);
    }
View Full Code Here

        whiteboardObj.put(i, obj);
        i++;
      }

      // Check if this User is the Mod:
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);

      if (currentClient == null) {
        return;
      }

      Long room_id = currentClient.getRoom_id();

      // log.debug("***** sendVars: " + whiteboardObj);

      // Store event in list
      String action = whiteboardObj.get(2).toString();

      if (action.equals("deleteMindMapNodes")) {

        // Simulate Single Delete Events for z-Index
        List actionObject = (List) whiteboardObj.get(3);

        List<List> itemObjects = (List) actionObject.get(3);

        Map whiteboardTempObj = new HashMap();
        whiteboardTempObj.put(2, "delete");

        for (List itemObject : itemObjects) {

          List<Object> tempActionObject = new LinkedList<Object>();
          tempActionObject.add("mindmapnode");
          tempActionObject.add(itemObject.get(0)); // z-Index -8
          tempActionObject.add(null); // simulate -7
          tempActionObject.add(null); // simulate -6
          tempActionObject.add(null); // simulate -5
          tempActionObject.add(null); // simulate -4
          tempActionObject.add(null); // simulate -3
          tempActionObject.add(null); // simulate -2
          tempActionObject.add(itemObject.get(1)); // Object-Name -1

          whiteboardTempObj.put(3, tempActionObject);

          whiteboardManagement.addWhiteBoardObjectById(
              room_id, whiteboardTempObj, whiteboardId);

        }

      } else {

        whiteboardManagement.addWhiteBoardObjectById(
            room_id, whiteboardObj, whiteboardId);

      }

      Map<String, Object> sendObject = new HashMap<String, Object>();
      sendObject.put("id", whiteboardId);
      sendObject.put("param", whiteboardObjParam);

      boolean showDrawStatus = getWhiteboardDrawStatus();

      // Notify all Clients of that Scope (Room)
      for (Set<IConnection> conset : current.getScope().getConnections()) {
      for (IConnection conn : conset) {
        if (conn != null) {
          if (conn instanceof IServiceCapableConnection) {
            IClient client = conn.getClient();
            if (SessionVariablesUtil.isScreenClient(client)) {
              // screen sharing clients do not receive events
              continue;
            } else if (SessionVariablesUtil.isAVClient(client)) {
              // AVClients or potential AVClients do not receive events
              continue;
            } if (client.getId().equals(
                current.getClient().getId())) {
              // don't send back to same user
              continue;
            }
            ((IServiceCapableConnection) conn).invoke(
              "sendVarsToWhiteboardById",
View Full Code Here

  }

  public synchronized int sendVarsModeratorGeneral(Object vars) {
    log.debug("*..*sendVars: " + vars);
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);
      // Long room_id = currentClient.getRoom_id();

      log.debug("***** id: " + currentClient.getStreamid());

      boolean ismod = currentClient.getIsMod();

      if (ismod) {
        log.debug("CurrentScope :" + current.getScope().getName());
        // Send to all Clients of the same Scope
        for (Set<IConnection> conset : current.getScope().getConnections()) {
        for (IConnection conn : conset) {
          if (conn != null) {
            if (conn instanceof IServiceCapableConnection) {
              IClient client = conn.getClient();
              if (SessionVariablesUtil.isScreenClient(client)) {
                // screen sharing clients do not receive events
                continue;
              } else if (SessionVariablesUtil.isAVClient(client)) {
                // AVClients or potential AVClients do not receive events
                continue;
              } if (client.getId().equals(current.getClient().getId())) {
                // don't send back to same user
                continue;
              }
              ((IServiceCapableConnection) conn).invoke("sendVarsToModeratorGeneral", new Object[] { vars },this);
            }
View Full Code Here

   * @return 1
   */
  @SuppressWarnings({ "rawtypes" })
  public synchronized int sendBrowserMessageToMembers(Object newMessage) {
    try {
      IConnection current = Red5.getConnectionLocal();

      List newMessageList = (List) newMessage;

      String action = newMessageList.get(0).toString();

      BrowserStatus browserStatus = (BrowserStatus) current.getScope()
          .getAttribute("browserStatus");

      if (browserStatus == null) {
        browserStatus = new BrowserStatus();
      }

      if (action.equals("initBrowser") || action.equals("newBrowserURL")) {
        browserStatus.setBrowserInited(true);
        browserStatus.setCurrentURL(newMessageList.get(1).toString());
      } else if (action.equals("closeBrowserURL")) {
        browserStatus.setBrowserInited(false);
      }

      current.getScope().setAttribute("browserStatus", browserStatus);
     
      syncMessageToCurrentScope("sendVarsToMessage", newMessage, false);

    } catch (Exception err) {
      log.error("[sendMessage]", err);
View Full Code Here

   * @param sendSelf send to the current client as well
   * @param sendScreen send to the current client as well
   */
  public synchronized void syncMessageToCurrentScope(String remoteMethodName, Object newMessage, boolean sendSelf, boolean sendScreen) {
    try {
      IConnection current = Red5.getConnectionLocal();

      // Send to all Clients of that Scope(Room)
      for (Set<IConnection> conset : current.getScope().getConnections()) {
      for (IConnection conn : conset) {
        if (conn != null) {
          if (conn instanceof IServiceCapableConnection) {
            IClient client = conn.getClient();
            if (!sendScreen && SessionVariablesUtil.isScreenClient(client)) {
              // screen sharing clients do not receive events
              continue;
            } else if (SessionVariablesUtil.isAVClient(client)) {
              // AVClients or potential AVClients do not receive events
              continue;
            } else if (!sendSelf && client.getId().equals(
                current.getClient().getId())) {
              //Do not send back to self
              continue;
            }
            ((IServiceCapableConnection) conn).invoke(
                remoteMethodName, new Object[] { newMessage }, this);
View Full Code Here

   * @param sync
   * @return 1 in case of success, -1 otherwise
   */
  public synchronized int sendMessageWithClientWithSyncObject(Object newMessage, boolean sync) {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);

      HashMap<String, Object> hsm = new HashMap<String, Object>();
      hsm.put("client", currentClient);
      hsm.put("message", newMessage);
     
View Full Code Here

   * @return 1 in case of no exceptions, -1 otherwise
   */
  public synchronized int sendMessageWithClientById(Object newMessage,
      String clientId) {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager
          .getClientByStreamId(current.getClient().getId(), null);

      HashMap<String, Object> hsm = new HashMap<String, Object>();
      hsm.put("client", currentClient);
      hsm.put("message", newMessage);

      // broadcast Message to specific user with id inside the same Scope
      for (Set<IConnection> conset : current.getScope().getConnections()) {
      for (IConnection conn : conset) {
        if (conn.getClient().getId().equals(clientId)) {
          ((IServiceCapableConnection) conn).invoke(
              "sendVarsToMessageWithClient",
              new Object[] { hsm }, this);
View Full Code Here

      Collection<Set<IConnection>> concolset = null;

      if (currentClient == null) {
        // Must be from a previous session, search for user in current
        // scope
        IConnection current = Red5.getConnectionLocal();
        // Notify all Clients of that Scope (Room)
        concolset = current.getScope().getConnections();
      } else {
        // default Scope Name
        String scopeName = "hibernate";
        if (currentClient.getRoom_id() != null) {
          scopeName = currentClient.getRoom_id().toString();
View Full Code Here

   *             recording instead of iterating through connections!
   * @return true in case there is recording session, false otherwise, null if any exception happend
   */
  public synchronized Boolean getInterviewRecordingStatus() {
    try {
      IConnection current = Red5.getConnectionLocal();

      for (Set<IConnection> conset : current.getScope().getConnections()) {
        for (IConnection conn : conset) {
          if (conn != null) {
            Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null);
 
            if (rcl.getIsRecording() != null && rcl.getIsRecording()) {
View Full Code Here

TOP

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

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.