コード例 #1
0
  public static void stopRecording(String roomId) {
    log.debug("entered stopRecording for room " + roomId);

    try {
      if (roomId != null && roomFileMap.get(roomId) != null) {
        WhiteboardVideoVO obj = (WhiteboardVideoVO) roomFileMap.get(roomId);
        // DataOutputStream os = obj.getOs();
        // os.close();
        boolean val = VideoDataDAO.updateVideoData(obj.getId());
        if (val == false) log.error(" could not update database for update  ");
        roomFileMap.remove(roomId);
      }
    } catch (Exception e) {

      log.error(e.getMessage(), e);
      e.printStackTrace();
    }
  }
コード例 #2
0
  public static void writeToFile(byte[] data, String roomId, String firstPacket, String counter) {
    try {
      log.debug("entered writeToFile " + roomId + " counter: " + counter);
      String filePath = null;
      if (firstPacket != null && firstPacket.equals("true")) {
        log.debug(
            "writing data to new file for the first time..."
                + data.length
                + "  the length is "
                + data);

        filePath =
            InnowhiteProperties.getPropertyVal(InnowhiteConstants.VIDEOS_PATH)
                + roomId
                + "_"
                + VideoDataDAO.getLatestWhiteboardRoomId(roomId)
                + ".flv";
        // os = new DataOutputStream(new FileOutputStream(filePath));

        VideoDataVO videoDataVO = new VideoDataVO();
        videoDataVO.setFlvFilePath(filePath);
        videoDataVO.setRoomName(roomId);
        int id = VideoDataDAO.saveVideoData(videoDataVO);
        WhiteboardVideoVO obj = new WhiteboardVideoVO(filePath, id);
        roomFileMap.put(roomId, obj);

      } else {

        WhiteboardVideoVO obj = (WhiteboardVideoVO) roomFileMap.get(roomId);
        filePath = obj.getFileId();
      }

      if (counter != null && counter.trim().length() > 0) {
        int val = Integer.parseInt(counter);
        TempWhiteboardVideoDAO.saveWBFrameData(roomId, val, data, filePath);
      }

    } catch (Exception e) {
      log.error(e.getMessage(), e);
      e.printStackTrace();
    }
  }