Package org.red5.server.stream

Examples of org.red5.server.stream.ClientBroadcastStream


  /** {@inheritDoc} */
  public IClientBroadcastStream newBroadcastStream(int streamId) {
    if (isValidStreamId(streamId)) {
      // get ClientBroadcastStream defined as a prototype in red5-common.xml
      ClientBroadcastStream cbs = (ClientBroadcastStream) scope.getContext().getBean("clientBroadcastStream");
      Integer buffer = streamBuffers.get(streamId - 1);
      if (buffer != null) {
        cbs.setClientBufferDuration(buffer);
      }
      cbs.setStreamId(streamId);
      cbs.setConnection(this);
      cbs.setName(createStreamName());
      cbs.setScope(this.getScope());

      registerStream(cbs);
      usedStreams.incrementAndGet();
      return cbs;
    }
View Full Code Here


      }
      /**
       * Picking up the ClientBroadcastStream defined as a spring
       * prototype in red5-common.xml
       */
      ClientBroadcastStream cbs = (ClientBroadcastStream) scope
          .getContext().getBean("clientBroadcastStream");
      Integer buffer = streamBuffers.get(streamId - 1);
      if (buffer != null)
        cbs.setClientBufferDuration(buffer);
      cbs.setStreamId(streamId);
      cbs.setConnection(this);
      cbs.setName(createStreamName());
      cbs.setScope(this.getScope());

      registerStream(cbs);
      usedStreams++;
      return cbs;
    }
View Full Code Here

    private void recordStream(IBroadcastStream stream) {
      IConnection conn = Red5.getConnectionLocal();    
      String streamName = stream.getPublishedName();
    
      try {
        ClientBroadcastStream cstream = (ClientBroadcastStream) this.getBroadcastStream(conn.getScope(), stream.getPublishedName() );
        cstream.saveAs(streamName, false);
      } catch(Exception e) {
        System.out.println("ERROR while recording stream " + e.getMessage());
        e.printStackTrace();
      }     
    }
View Full Code Here

          + broadcastid);
      // log.debug("Application.getInstance()"+Application.getInstance());
      log.debug("Scope " + conn);
      log.debug("Scope " + conn.getScope());
      // Get a reference to the current broadcast stream.
      ClientBroadcastStream stream = (ClientBroadcastStream) scopeApplicationAdapter
          .getBroadcastStream(conn.getScope(), broadcastid);

      if (stream == null) {
        log.debug("Unable to get stream: " + streamName);
        return;
      }
      // Save the stream to disk.
      log.debug("### stream " + stream);
      log.debug("### streamName " + streamName);
      log.debug("### conn.getScope() " + conn.getScope());
      log.debug("### flvRecordingMetaDataId "
          + flvRecordingMetaDataId);
      log.debug("### isScreenData " + isScreenData);
      log.debug("### isInterview " + isInterview);

      StreamListener streamListener = new StreamListener(!isScreenData, streamName,
                                conn.getScope(), flvRecordingMetaDataId, isScreenData,
                                isInterview, flvRecordingMetaDataDao, flvRecordingMetaDeltaDao);

      streamListeners.put(flvRecordingMetaDataId, streamListener);

      stream.addStreamListener(streamListener);
      // Just for Debug Purpose
      // stream.saveAs(streamName+"_DEBUG", false);
    } catch (Exception e) {
      log.error("Error while saving stream: " + streamName, e);
    }
View Full Code Here

      StreamListener listenerAdapter = streamListeners.get(flvRecordingMetaDataId);
     
      log.debug("Stream Closing :: " + flvRecordingMetaDataId);
     
      ClientBroadcastStream stream = (ClientBroadcastStream) streamToClose;

      //the stream can be null if the user just closes the browser
      //without canceling the recording before leaving
      if (stream != null) {
        //Iterate through all stream listeners and stop the appropriate
        if (stream.getStreamListeners() != null) {
 
          for (IStreamListener iStreamListener : stream
              .getStreamListeners()) {
            stream.removeStreamListener(iStreamListener);
          }
        }
      }
     
      if (listenerAdapter == null) {
View Full Code Here

      long now = System.currentTimeMillis();
      String recordingStreamName = stream.getPublishedName(); // + "-" + now; /** Comment out for now...forgot why I added this - ralam */
    
      try {       
        log.info("Recording stream " + recordingStreamName );
        ClientBroadcastStream cstream = (ClientBroadcastStream) this.getBroadcastStream(conn.getScope(), stream.getPublishedName());
        cstream.saveAs(recordingStreamName, false);
      } catch(Exception e) {
        log.error("ERROR while recording stream " + e.getMessage());
        e.printStackTrace();
      }     
    }
View Full Code Here

          + broadcastid);
      // log.debug("Application.getInstance()"+Application.getInstance());
      log.debug("Scope " + conn);
      log.debug("Scope " + conn.getScope());
      // Get a reference to the current broadcast stream.
      ClientBroadcastStream stream = (ClientBroadcastStream) scopeApplicationAdapter
          .getBroadcastStream(conn.getScope(), broadcastid);

      if (stream == null) {
        log.debug("Unable to get stream: " + streamName);
        return;
      }
      // Save the stream to disk.
      if (isScreenData) {
       
        StreamVideoListener streamScreenListener = new StreamVideoListener(streamName,
                                    conn.getScope(), flvRecordingMetaDataId, isScreenData,
                                    isInterview, flvRecordingMetaDataDao);
       
        streamListeners.put(flvRecordingMetaDataId, streamScreenListener);
       
        stream.addStreamListener(streamScreenListener);
      } else {

        log.debug("### stream " + stream);
        log.debug("### streamName " + streamName);
        log.debug("### conn.getScope() " + conn.getScope());
        log.debug("### flvRecordingMetaDataId "
            + flvRecordingMetaDataId);
        log.debug("### isScreenData " + isScreenData);
        log.debug("### isInterview " + isInterview);

        StreamAudioListener streamAudioListener = new StreamAudioListener(streamName,
                                  conn.getScope(), flvRecordingMetaDataId, isScreenData,
                                  isInterview, flvRecordingMetaDeltaDao, flvRecordingMetaDataDao);

        streamListeners.put(flvRecordingMetaDataId, streamAudioListener);

        stream.addStreamListener(streamAudioListener);
      }
      // Just for Debug Purpose
      // stream.saveAs(streamName+"_DEBUG", false);
    } catch (Exception e) {
      log.error("Error while saving stream: " + streamName, e);
View Full Code Here

      BaseStreamListener listenerAdapter = streamListeners.get(flvRecordingMetaDataId);
     
      log.debug("Stream Closing :: " + flvRecordingMetaDataId);
     
      ClientBroadcastStream stream = (ClientBroadcastStream) streamToClose;

      //the stream can be null if the user just closes the browser
      //without canceling the recording before leaving
      if (stream != null) {
        //Iterate through all stream listeners and stop the appropriate
        if (stream.getStreamListeners() != null) {
 
          for (IStreamListener iStreamListener : stream
              .getStreamListeners()) {
            stream.removeStreamListener(iStreamListener);
          }
        }
      }
     
      if (listenerAdapter == null) {
View Full Code Here

//        if ( kt < 10 ) {
//            logger.debug( "+++ " + videoData );
//            System.out.println( "+++ " + videoData);
//        }

        RTMPMessage rtmpMsg = new RTMPMessage();
        rtmpMsg.setBody( videoData );
        publishStreamData( publishStreamId, rtmpMsg );
    }
View Full Code Here

//        if ( kt < 10 ) {
//            logger.debug( "+++ " + videoData );
//            System.out.println( "+++ " + videoData);
//        }

        RTMPMessage rtmpMsg = new RTMPMessage();
        rtmpMsg.setBody( videoData );
        publishStreamData( publishStreamId, rtmpMsg );
    }
View Full Code Here

TOP

Related Classes of org.red5.server.stream.ClientBroadcastStream

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.