Package org.apache.openmeetings.db.entity.room

Examples of org.apache.openmeetings.db.entity.room.Client


  public synchronized Map<String, String> screenSharerAction(Map<String, Object> map) {
    try {
      log.debug("-----------  screenSharerAction");
      IConnection current = Red5.getConnectionLocal();

      Client rc = sessionManager.getClientByStreamId(current.getClient().getId(), null);

      Map<String, String> returnMap = new HashMap<String, String>();

      if (rc != null) {
        boolean changed = false;
        if (Boolean.valueOf("" + map.get("stopStreaming")) && rc.isStartStreaming()) {
          changed = true;
          rc.setStartStreaming(false);
          //Send message to all users
          syncMessageToCurrentScope("stopScreenSharingMessage", rc, false);
         
          returnMap.put("result", "stopSharingOnly");
        }
        if (Boolean.valueOf("" + map.get("stopRecording")) && rc.getIsRecording()) {
          changed = true;
          rc.setStartRecording(false);
          rc.setIsRecording(false);
         
          returnMap.put("result", "stopRecordingOnly");
          //Send message to all users
          syncMessageToCurrentScope("stopRecordingMessage", rc, false);

          flvRecorderService.stopRecordAndSave(current.getScope(), rc, null);
        }
        if (Boolean.valueOf("" + map.get("stopPublishing")) && rc.isScreenPublishStarted()) {
          changed = true;
          rc.setScreenPublishStarted(false);
          returnMap.put("result", "stopPublishingOnly");
         
          //Send message to all users
          syncMessageToCurrentScope("stopPublishingMessage", rc, false);
        }
       
        if (changed) {
          sessionManager.updateClientByStreamId(rc.getStreamid(), rc, false, null);
         
          if (!rc.isStartStreaming() && !rc.isStartRecording() && !rc.isStreamPublishStarted()) {
            returnMap.put("result", "stopAll");
          }
        }
      }
      return returnMap;
View Full Code Here


      log.debug("checkScreenSharing -2- " + streamid);

      List<Client> screenSharerList = new LinkedList<Client>();

      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);

      for (Client rcl : sessionManager.getClientListByRoomAll(currentClient.getRoom_id())) {
        if (rcl.isStartStreaming()) {
          screenSharerList.add(rcl);
        }
      }
View Full Code Here

  public synchronized Map setConnectionAsSharingClient(Map map) {
    try {
      log.debug("-----------  setConnectionAsSharingClient");
      IConnection current = Red5.getConnectionLocal();

      Client currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null);

      if (currentClient != null) {
        boolean startRecording = Boolean.valueOf("" + map.get("startRecording"));
        boolean startStreaming = Boolean.valueOf("" + map.get("startStreaming"));
        boolean startPublishing = Boolean.valueOf("" + map.get("startPublishing"))
          && (0 == sessionManager.getPublishingCount(currentClient.getRoom_id()));

        currentClient.setRoom_id(Long.parseLong(current.getScope().getName()));

        // Set this connection to be a RTMP-Java Client
        currentClient.setIsScreenClient(true);
       
        SessionVariablesUtil.setIsScreenClient(current.getClient());
       
        currentClient.setUser_id(Long.parseLong(map.get("user_id").toString()));
        SessionVariablesUtil.setUserId(current.getClient(), Long.parseLong(map.get("user_id").toString()));

        boolean alreadyStreaming = currentClient.isStartStreaming();
        if (startStreaming) {
          currentClient.setStartStreaming(true);
        }
        boolean alreadyRecording = currentClient.isStartRecording();
        if (startRecording) {
          currentClient.setStartRecording(true);
        }
        if (startPublishing) {
          currentClient.setStreamPublishStarted(true);
        }

        currentClient.setOrganization_id(Long.parseLong(map.get("organization_id").toString()));

        sessionManager.updateClientByStreamId(current.getClient().getId(), currentClient, false, null);

        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.isScreenPublishStarted()) {
          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());

        Client currentScreenUser = sessionManager.getClientByPublicSID(currentClient.getStreamPublishName(), false, null);

        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
        sessionManager.updateClientByStreamId(current.getClient().getId(), currentClient, false, null);
View Full Code Here

        IConnection current = Red5.getConnectionLocal();
        String streamid = current.getClient().getId();
        for (Set<IConnection> conset : current.getScope().getConnections()) {
        for (IConnection conn : conset) {
            if (conn != null) {
                Client rcl = this.sessionManager
                        .getClientByStreamId(conn
                                .getClient().getId(), null);
                if (rcl == null) {
                    // continue;
                } else if (rcl.getIsScreenClient() != null
                        && rcl.getIsScreenClient()) {
                    // continue;
                } else {
                    if (!streamid.equals(rcl.getStreamid())) {
                        // It is not needed to send back
                        // that event to the actuall
                        // Moderator
                        // as it will be already triggered
                        // in the result of this Function
                        // in the Client
                      Long id = Long.valueOf(rcl.getBroadCastID());
                      if (id != null && !broadcastList.contains(id)) {
                        broadcastList.add(id.intValue());
                      }
                    }
                }
View Full Code Here

      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();

      log.debug("getCurrentRoomClient -2- " + streamid);

      Client currentClient = sessionManager.getClientByStreamId(streamid, null);

      for (Client rcl : sessionManager.getClientListByRoom(currentClient.getRoom_id())) {
        if (rcl.getIsRecording()) {
          return rcl;
        }
      }
View Full Code Here

  public String recordMeetingStream(String roomRecordingName, String comment, Boolean isInterview) {
    try {
      log.debug(":: recordMeetingStream ::");

      IConnection current = Red5.getConnectionLocal();
      Client currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null);
      Long room_id = currentClient.getRoom_id();

      Date now = new Date();

      FlvRecording flvRecording = new FlvRecording();

      flvRecording.setFileHash("");
      flvRecording.setFileName(roomRecordingName);
      flvRecording.setInsertedBy(currentClient.getUser_id());
      flvRecording.setFolder(false);
      flvRecording.setIsImage(false);
      flvRecording.setIsPresentation(false);
      flvRecording.setIsRecording(true);
      flvRecording.setComment(comment);
      flvRecording.setIsInterview(isInterview);

      flvRecording.setRoom_id(room_id);
      flvRecording.setRecordStart(now);

      flvRecording.setWidth(currentClient.getVWidth());
      flvRecording.setHeight(currentClient.getVHeight());

      flvRecording.setOwnerId(currentClient.getUser_id());
      flvRecording.setStatus(FlvRecording.Status.PROCESSING);
      flvRecording = recordingDao.update(flvRecording);
      // Receive flvRecordingId
      Long flvRecordingId = flvRecording.getFlvRecordingId();

      // Update Client and set Flag
      currentClient.setIsRecording(true);
      currentClient.setFlvRecordingId(flvRecordingId);
      sessionManager.updateClientByStreamId(current.getClient().getId(), currentClient, false, null);

      // get all stream and start recording them
      for (Set<IConnection> conset : current.getScope().getConnections()) {
      for (IConnection conn : conset) {
        if (conn != null) {
          if (conn instanceof IServiceCapableConnection) {
            Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null);

            // Send every user a notification that the recording did start
            if (!rcl.getIsAVClient()) {
              ((IServiceCapableConnection) conn).invoke("startedRecording", new Object[] { currentClient }, this);
            }

            // If its the recording client we need another type of Meta Data
            if (rcl.getIsScreenClient()) {
              if (rcl.getFlvRecordingId() != null && rcl.isScreenPublishStarted()) {
                String streamName_Screen = generateFileName(flvRecordingId, rcl.getStreamPublishName().toString());

                Long flvRecordingMetaDataId = metaDataDao.addFlvRecordingMetaData(
                    flvRecordingId, rcl.getFirstname() + " " + rcl.getLastname(), now, false,
                    false, true, streamName_Screen, rcl.getInterviewPodId());

                // Start FLV Recording
                recordShow(conn, rcl.getStreamPublishName(), streamName_Screen, flvRecordingMetaDataId, true, isInterview);

                // Add Meta Data
                rcl.setFlvRecordingMetaDataId(flvRecordingMetaDataId);

                sessionManager.updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
              }
            } else if (rcl.getIsAVClient()
                && (rcl.getAvsettings().equals("av") || rcl.getAvsettings().equals("a") || rcl.getAvsettings().equals("v"))) {
              // if the user does publish av, a, v
              // But we only record av or a, video only is not interesting
              String streamName = generateFileName(flvRecordingId, String.valueOf(rcl.getBroadCastID()).toString());

              // Add Meta Data
              boolean isAudioOnly = false;
              if (rcl.getAvsettings().equals("a")) {
                isAudioOnly = true;
              }

              boolean isVideoOnly = false;
              if (rcl.getAvsettings().equals("v")) {
                isVideoOnly = true;
              }

              Long flvRecordingMetaDataId = metaDataDao.addFlvRecordingMetaData(flvRecordingId,
                  rcl.getFirstname() + " " + rcl.getLastname(), now, isAudioOnly, isVideoOnly, false, streamName,
                  rcl.getInterviewPodId());

              rcl.setFlvRecordingMetaDataId(flvRecordingMetaDataId);

              sessionManager.updateClientByStreamId(rcl.getStreamid(), rcl, false, null);

              // Start FLV recording
              recordShow(conn, String.valueOf(rcl.getBroadCastID()).toString(), streamName, flvRecordingMetaDataId, !isAudioOnly,
                  isInterview);
            }
          }
        }
      }
View Full Code Here

   * @return publicSID of current client
   */
  public synchronized String getPublicSID() {
    log.debug("-----------  getPublicSID");
    IConnection current = Red5.getConnectionLocal();
    Client currentClient = this.sessionManager
        .getClientByStreamId(current.getClient().getId(), null);
    sessionManager.updateClientByStreamId(current.getClient().getId(),
        currentClient, false, null);
    return currentClient.getPublicSID();
  }
View Full Code Here

  public synchronized Boolean overwritePublicSID(String newPublicSID) {
    try {
      log.debug("-----------  overwritePublicSID");
      IConnection current = Red5.getConnectionLocal();
      IClient c = current.getClient();
      Client currentClient = sessionManager.getClientByStreamId(c.getId(), null);
      if (currentClient == null) {
        return false;
      }
      SessionVariablesUtil.initClient(c, SessionVariablesUtil.isAVClient(c), newPublicSID);
      currentClient.setPublicSID(newPublicSID);
      sessionManager.updateClientByStreamId(c.getId(), currentClient, false, null);
      return true;
    } catch (Exception err) {
      log.error("[overwritePublicSID]", err);
    }
View Full Code Here

  public void roomLeave(IClient client, IScope room) {
    try {
      log.debug(String.format("roomLeave %s %s %s %s", client.getId(), room.getClients().size()
          , room.getContextPath(), room.getName()));

      Client currentClient = sessionManager.getClientByStreamId(client.getId(), null);

      // The Room Client can be null if the Client left the room by using
      // logicalRoomLeave
      if (currentClient != null) {
        log.debug("currentClient IS NOT NULL");
View Full Code Here

      IConnection current = Red5.getConnectionLocal();
      String streamid = current.getClient().getId();

      log.debug(streamid + " is leaving");

      Client currentClient = sessionManager.getClientByStreamId(streamid, null);

      roomLeaveByScope(currentClient, current.getScope(), true);
    } catch (Exception err) {
      log.error("[logicalRoomLeave]", err);
    }
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.db.entity.room.Client

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.