Package org.openmeetings.app.persistence.beans.recording

Examples of org.openmeetings.app.persistence.beans.recording.RoomRecording


      currentClient.setRoomRecordingName(recordingName);     
      this.clientListManager.updateClientByStreamId(current.getClient().getId(), currentClient);
     
      Date now = new Date();
     
      RoomRecording roomRecording = new RoomRecording();
      roomRecording.setConferenceType(conferenceType);
      roomRecording.setRoom_setup(Roommanagement.getInstance().getRoomById(currentClient.getRoom_id()));
      roomRecording.setRoomRecordingsTableString(roomRecordingsTableString);
      roomRecording.setStarttime(now);
      roomRecording.setComment(comment);
     
      //get all stream and start recording them
      Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
      for (Set<IConnection> conset : conCollection) {
        for (IConnection conn : conset) {
          if (conn != null) {
            if (conn instanceof IServiceCapableConnection) {
              RoomClient rcl = this.clientListManager.getClientByStreamId(conn.getClient().getId());
              log.error("is this users still alive? :"+rcl);
              //Check if the Client is in the same room and same domain
              if(room_id.equals(rcl.getRoom_id()) && room_id!=null){
               
                ((IServiceCapableConnection) conn).invoke("startedRecording",new Object[] { currentClient }, this);
               
                String remoteAdress = conn.getRemoteAddress();
                Date startDate = new Date();
               
                //add streamings to record File
                if (!conferenceType.equals("audience") || rcl.getIsMod()){
                 
                  RoomStream roomStream = new RoomStream();
                 
                  String streamName = generateFileName(Long.valueOf(rcl.getBroadCastID()).toString());
                 
                  //if the user does publish av, a, v
                  if (!rcl.getAvsettings().equals("n")){ 
                    recordShow(conn, rcl.getBroadCastID(), streamName);
                  }
                 
                  roomStream.setStreamName(streamName);
                  //stream starting
                  roomStream.setStreamstart(true);
                  //is not only a avset-event
                  roomStream.setAvset(false);
                  roomStream.setRemoteAdress(remoteAdress);
                  roomStream.setStartdate(startDate);
                  roomStream.setStarttime(0L);
                  roomStream.setRcl(rcl);
                 
                  if (roomRecording.getRoomStreams() == null) {
                    roomRecording.setRoomStreams(new LinkedList<RoomStream>());
                  }
                  roomRecording.getRoomStreams().add(roomStream);
                }
   
                //add room Clients enter/leave Events to record File
                RecordingClient roomClient = new RecordingClient();
                roomClient.setRemoteAdress(remoteAdress);
                roomClient.setRoomenter(true);
                roomClient.setStartdate(startDate);
                roomClient.setStarttime(0L);
                roomClient.setRcl(rcl);
                if (roomRecording.getRoomClients() == null) {
                  roomRecording.setRoomClients(new LinkedList<RecordingClient>());
                }
                roomRecording.getRoomClients().add(roomClient);
              }
            }
          }
        }   
      }
     
      roomRecording.setInitwhiteboardvars(initwhiteboardvars);
      XStream xStream_temp = new XStream(new XppDriver());
      xStream_temp.setMode(XStream.NO_REFERENCES);
      roomRecording.setInitwhiteboardvarsInXml(xStream_temp.toXML(initwhiteboardvars));
     
      roomRecording.setRecordingName(recordingName);
      roomRecording.setStarttime(new java.util.Date());
     
      roomRecording.setStartedby(currentClient);
     
      //add Room Client enter/leave events
      //moved inside function - loop
     
      //add Stream-Events
      //moved inside function - loop
     
      //add Whiteboard-Events
      roomRecording.setWhiteboard(new LinkedList<WhiteBoardEvent>());
     
      //add Chat-Events
      roomRecording.setChatvalues(new LinkedList<ChatvaluesEvent>());
     
      roomRecordingList.put(recordingName, roomRecording);
     
      return recordingName;
    } catch (Exception err) {
View Full Code Here


      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session.createQuery(hql);
      query.setParameter("roomrecordingId",roomrecordingId);
     
      RoomRecording roomRecording = null;
      try {
        roomRecording = (RoomRecording) query.getSingleResult();
        } catch (NoResultException ex) {
        }
      tx.commit();
View Full Code Here

  public Long _stopRecordMeetingStream(String roomrecordingName){
    try {
      IConnection current = Red5.getConnectionLocal();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(current.getClient().getId());

      RoomRecording roomRecording = roomRecordingList.get(roomrecordingName);
      Long room_id = currentClient.getRoom_id()

      String conferenceType = roomRecording.getConferenceType();
     
      //get all stream and stop recording them
      //Todo: Check that nobody does Recording at the same time Issue 253
      Collection<Set<IConnection>> conCollection = current.getScope().getConnections();
      for (Set<IConnection> conset : conCollection) {
View Full Code Here

  }
 
  public static Long _stopRecordAndSave(IScope scope, String roomrecordingName, RoomClient currentClient){
    try {
      log.debug("stopRecordAndSave "+currentClient.getUsername()+","+currentClient.getUserip());
      RoomRecording roomRecording = roomRecordingList.get(roomrecordingName);
     
      Long room_id = currentClient.getRoom_id();
      currentClient.setIsRecording(false);
      currentClient.setRoomRecordingName("");
      ClientListManager.getInstance().updateClientByStreamId(currentClient.getStreamid(), currentClient);
     
     
      String conferenceType = roomRecording.getConferenceType();
     
      //get all stream and stop recording them
      //Todo: Check that nobody does Recording at the same time Issue 253
      Collection<Set<IConnection>> conCollection = scope.getConnections();
      for (Set<IConnection> conset : conCollection) {
        for (IConnection conn : conset) {
          if (conn != null) {
            if (conn instanceof IServiceCapableConnection) {
             
              RoomClient rcl = ClientListManager.getInstance().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(room_id.equals(rcl.getRoom_id()) && room_id!=null){
                if (!conferenceType.equals("audience") || rcl.getIsMod()){
                  //stop the recorded flv and add the event to the notifications
                  log.debug("*** sendClientBroadcastNotifications Any Client is Recording - stop that");
                  StreamService._addRoomClientEnterEventFunc(rcl, roomrecordingName, rcl.getUserip(), false);
                  _stopRecordingShowForClient(conn, rcl, roomrecordingName, true);
                }
              }
             
            }
          }
        }
      }       
     
     
      String newRecordFileName = roomRecording.getRoomRecordingsTableString();
      String comment = roomRecording.getComment();
     
      Date starttime = roomRecording.getStarttime();
      Date endtime =  new java.util.Date();
      Long duration = endtime.getTime() - starttime.getTime();
      roomRecording.setEndtime(endtime);
     
      roomRecording.setEnduser(currentClient);
     
      roomRecording.setRecordname(newRecordFileName);
     
      RoomClient startedClient = roomRecording.getStartedby();
      Long recordedby = startedClient.getUser_id();
      Users us = null;
      if (recordedby!=null && recordedby>0){
        us = UsersDaoImpl.getInstance().getUser(recordedby);
      }
     
     
//      //TODO: Replace Persistence Logic with Database-DAO
//      XStream xStream = new XStream(new XppDriver());
//      xStream.setMode(XStream.NO_REFERENCES);
//      String xmlString = xStream.toXML(roomRecording);
//     
//      //log.error(xmlString);
//     
//      //make persistent
//      Long recording_id = RecordingDaoImpl.getInstance().addRecording(newRecordFileName, duration, "", currentClient.getRoom_id(), us, comment, null);
//     
//      //save XML to Disk
//      IScope scope = Red5.getConnectionLocal().getScope().getParent();
//      String current_dir = scope.getResource("upload/").getFile().getAbsolutePath();
//      //System.out.println(current_dir  + File.separatorChar + this.folderForRecordings);
//      File f = new File(current_dir  + File.separatorChar + folderForRecordings);
//      if (!f.exists()){
//        f.mkdir();
//      }
//      String fileName = f.getAbsolutePath() + File.separatorChar + fileNameXML+recording_id+".xml";
//      //System.out.println("fileName"+fileName);
//      PrintWriter pw = new PrintWriter(new FileWriter(fileName));
//        pw.println(xmlString);
//        pw.flush();
//        pw.close();
//       
//        List<LinkedHashMap<String,Object>> roomClients = (List<LinkedHashMap<String,Object>>)roomRecording.get("roomclients");
//        for (Iterator<LinkedHashMap<String,Object>> iter = roomClients.iterator();iter.hasNext();){
//          LinkedHashMap<String,Object> roomClient = iter.next();
//         
//          log.debug("###### NEW RRR1: "+roomClient.get("roomenter"));
//        log.debug("###### NEW RRR2: "+roomClient.get("startdate"));
//        log.debug("###### NEW RRR3: "+roomClient.get("starttime"));
//        RoomClient rcl = (RoomClient) roomClient.get("rcl");
//        log.debug("###### NEW RRR4: "+rcl.getBroadCastID());
//        log.debug("###### NEW RRR5: "+rcl.getConnectedSince());
//        log.debug("###### NEW RRR6: "+rcl.getPublicSID());
//        log.debug("###### NEW RRR7: "+rcl.getUserip());  
//       
//        }
       
      //remove recording from Temp - List
      roomRecordingList.remove(roomrecordingName);
     
     
      //Store to database
     
      //First Store the RoomRecording
      Long roomRecordingId = RoomRecordingDaoImpl.getInstance().addRoomRecording(roomRecording);
      RoomRecording roomRecordingRemote = RoomRecordingDaoImpl.getInstance().getRoomRecordingById(roomRecordingId);
     
      //Store all RoomRecordingClients
      for (Iterator<RecordingClient> iter = roomRecording.getRoomClients().iterator();iter.hasNext();) {
        RecordingClient recordingClient = iter.next();
        recordingClient.setRoomRecordingId(roomRecordingId);
View Full Code Here

      //this cannot be handled here, as to stop a stream and to leave a room is not
      //the same type of event.
      //StreamService.addRoomClientEnterEventFunc(rcl, roomrecordingName, rcl.getUserip(), false);
      log.error("### stopRecordingShowForClient: "+rcl.getIsRecording()+","+rcl.getUsername()+","+rcl.getUserip());
     
      RoomRecording roomRecording = roomRecordingList.get(roomrecordingName);
      Date recordingsStartTime = roomRecording.getStarttime();
      Date currentDate = new Date();
     
      RoomStream roomStream = new RoomStream();
      roomStream.setStreamName("");
      roomStream.setStreamstart(false);
      roomStream.setAvset(false);
      roomStream.setRemoteAdress(conn.getRemoteAddress());
      roomStream.setStartdate(currentDate);
      roomStream.setStarttime(currentDate.getTime()-recordingsStartTime.getTime());
      roomStream.setRcl(rcl);
     
      roomRecording.getRoomStreams().add(roomStream);
      roomRecordingList.put(roomrecordingName, roomRecording);

      if ((rcl.getAvsettings().equals("a") || rcl.getAvsettings().equals("v")
          || rcl.getAvsettings().equals("av")) && doStopStream){
        stopRecordingShow(conn,rcl.getBroadCastID());
View Full Code Here

  }
 
  public static void _addRecordingByStreamId(IConnection conn, String streamId,
      RoomClient rcl, String roomrecordingName) {
    try {
      RoomRecording roomRecording = roomRecordingList.get(roomrecordingName);
      String conferenceType = roomRecording.getConferenceType();
     
      //log.debug("addRecordingByStreamId "+conferenceType+" MOD: "+rcl.getIsMod());
     
      if (!conferenceType.equals("audience") || rcl.getIsMod()){
       
        //log.debug("AV-Settings: "+rcl.getAvsettings());
       
        Date recordingsStartTime = roomRecording.getStarttime();
        Date currentDate = new Date();
       
       
       
        String streamName = generateFileName(Long.valueOf(rcl.getBroadCastID()).toString());
        String remoteAdress = conn.getRemoteAddress();
       
        //if the user does publish av, a, v
        if (!rcl.getAvsettings().equals("n")){
          //log.debug("Record Show");
          recordShow(conn, rcl.getBroadCastID(), streamName);
        }
       
        RoomStream roomStream = new RoomStream();
        roomStream.setStreamName(streamName);
        //this is a recording event
        roomStream.setStreamstart(true);
        //this is not an av event
        roomStream.setAvset(true);
        roomStream.setRemoteAdress(remoteAdress);
        roomStream.setStartdate(new java.util.Date());
        roomStream.setStarttime(currentDate.getTime()-recordingsStartTime.getTime());
        roomStream.setRcl(rcl);
       
        roomRecording.getRoomStreams().add(roomStream);
        roomRecordingList.put(roomrecordingName, roomRecording);
      }
    } catch (Exception err) {
      log.error("[addRecordingByStreamId]",err);
   
View Full Code Here

 
  public static void addWhiteBoardEvent(String roomrecordingName,Object vars) {
    try {
     
      log.debug("addWhiteBoardEvent roomrecordingName: "+roomrecordingName);
      RoomRecording roomRecording = roomRecordingList.get(roomrecordingName);
     
      Date recordingsStartTime = roomRecording.getStarttime();
      Date currentDate = new Date();
     
      XStream xStream = new XStream(new XppDriver());
      xStream.setMode(XStream.NO_REFERENCES);
      String action = xStream.toXML(vars);
     
      WhiteBoardEvent whiteBoardEvent = new WhiteBoardEvent();
      whiteBoardEvent.setStarttime(currentDate.getTime()-recordingsStartTime.getTime());
      whiteBoardEvent.setAction(action);
     
      roomRecording.getWhiteboard().add(whiteBoardEvent);
     
      roomRecordingList.put(roomrecordingName, roomRecording);
     
    } catch (Exception err) {
      log.error("[addWhiteBoardEvent]",err);
View Full Code Here

 
  public static void addChatEvent(String roomrecordingName,Object vars) {
    try {
     
      log.debug("addChatEvent roomrecordingName: "+roomrecordingName);
      RoomRecording roomRecording = roomRecordingList.get(roomrecordingName);
     
      Date recordingsStartTime = roomRecording.getStarttime();
      Date currentDate = new Date();
     
      XStream xStream = new XStream(new XppDriver());
      xStream.setMode(XStream.NO_REFERENCES);
      String action = xStream.toXML(vars);
     
      ChatvaluesEvent chatvaluesEvent = new ChatvaluesEvent();
      chatvaluesEvent.setStarttime(currentDate.getTime()-recordingsStartTime.getTime());
      chatvaluesEvent.setAction(action);
     
      roomRecording.getChatvalues().add(chatvaluesEvent);
     
      roomRecordingList.put(roomrecordingName, roomRecording);
     
    } catch (Exception err) {
      log.error("[addChatEvent]",err);
View Full Code Here

 
 
  public static void _addRoomClientAVSetEvent(RoomClient rcl, String roomrecordingName,
      String remoteAdress) {
    try {
      RoomRecording roomRecording = roomRecordingList.get(roomrecordingName);
      Date recordingsStartTime = roomRecording.getStarttime();
      Date currentDate = new Date();
      List<RoomStream> roomStreams = roomRecording.getRoomStreams();
     
      RoomStream roomStream = new RoomStream();
      roomStream.setStreamName("");
      roomStream.setStreamstart(false);
      roomStream.setAvset(true);
      roomStream.setRemoteAdress(remoteAdress);
      roomStream.setStartdate(currentDate);
      roomStream.setStarttime(currentDate.getTime()-recordingsStartTime.getTime());
      roomStream.setRcl(rcl);
     
      roomRecording.getRoomStreams().add(roomStream);
      roomRecordingList.put(roomrecordingName, roomRecording);     
    } catch (Exception err) {
      log.error("[addRoomClientAVSetEvent]",err);
   
  } 
View Full Code Here

 
 
  public static void _addRoomClientEnterEventFunc(RoomClient rcl, String roomrecordingName,
        String remoteAdress, boolean enter) {
    try {
      RoomRecording roomRecording = roomRecordingList.get(roomrecordingName);
      Date recordingsStartTime = roomRecording.getStarttime();
      Date currentDate = new Date();
     
      RecordingClient roomClient = new RecordingClient();           
      roomClient.setRemoteAdress(remoteAdress);
      roomClient.setRoomenter(enter);
      roomClient.setStartdate(currentDate);
      roomClient.setStarttime(currentDate.getTime()-recordingsStartTime.getTime());
//     
//      if (!enter) {
//        log.debug("###### NEW USER1: "+rcl.getBroadCastID());
//        log.debug("###### NEW USER2: "+rcl.getConnectedSince());
//        log.debug("###### NEW USER3: "+rcl.getPublicSID());
//        log.debug("###### NEW USER4: "+rcl.getUserip());
//      }
      roomClient.setRcl(rcl);
     
      roomRecording.getRoomClients().add(roomClient);
      roomRecordingList.put(roomrecordingName, roomRecording);     
    } catch (Exception err) {
      log.error("[addRoomClientEnterEvent]",err);
   
  } 
View Full Code Here

TOP

Related Classes of org.openmeetings.app.persistence.beans.recording.RoomRecording

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.