Package org.red5.server.api.stream

Examples of org.red5.server.api.stream.IClientStream


  public void receiveVideo(boolean receive) {
    IConnection conn = Red5.getConnectionLocal();
    if (conn instanceof IStreamCapableConnection) {
      IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
      int streamId = conn.getStreamId();
      IClientStream stream = streamConn.getStreamById(streamId);
      if (stream != null && stream instanceof ISubscriberStream) {
        ISubscriberStream subscriberStream = (ISubscriberStream) stream;
        subscriberStream.receiveVideo(receive);
      }
    }
View Full Code Here


  public void receiveAudio(boolean receive) {
    IConnection conn = Red5.getConnectionLocal();
    if (conn instanceof IStreamCapableConnection) {
      IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
      int streamId = conn.getStreamId();
      IClientStream stream = streamConn.getStreamById(streamId);
      if (stream != null && stream instanceof ISubscriberStream) {
        ISubscriberStream subscriberStream = (ISubscriberStream) stream;
        subscriberStream.receiveAudio(receive);
      }
    }
View Full Code Here

        // get the stream id
        int streamId = setBuffer.getStreamId();
        // get requested buffer size in milliseconds
        int buffer = setBuffer.getBufferLength();
        log.debug("Client sent a buffer size: {} ms for stream id: {}", buffer, streamId);
        IClientStream stream = null;
        if (streamId != 0) {
          // The client wants to set the buffer time
          stream = conn.getStreamById(streamId);
          if (stream != null) {
            stream.setClientBufferDuration(buffer);
            log.trace("Stream type: {}", stream.getClass().getName());
          }
        }
        //catch-all to make sure buffer size is set
        if (stream == null) {
          // Remember buffer time until stream is created
View Full Code Here

    public void closeStream() {
    IConnection conn = Red5.getConnectionLocal();
    if (!(conn instanceof IStreamCapableConnection)) {
      return;
    }
    IClientStream stream = ((IStreamCapableConnection) conn)
        .getStreamById(getCurrentStreamId());
    if (stream != null) {
      if (stream instanceof IClientBroadcastStream) {
        IClientBroadcastStream bs = (IClientBroadcastStream) stream;
        IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs
            .getPublishedName());
        if (bsScope != null && conn instanceof BaseConnection) {
          ((BaseConnection) conn).unregisterBasicScope(bsScope);
        }
      }
      stream.close();
    }
    ((IStreamCapableConnection) conn)
        .deleteStreamById(getCurrentStreamId());
  }
View Full Code Here

    deleteStream(streamConn, streamId);
  }

  /** {@inheritDoc} */
    public void deleteStream(IStreamCapableConnection conn, int streamId) {
    IClientStream stream = conn.getStreamById(streamId);
    if (stream != null) {
      if (stream instanceof IClientBroadcastStream) {
        IClientBroadcastStream bs = (IClientBroadcastStream) stream;
        IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs
            .getPublishedName());
        if (bsScope != null && conn instanceof BaseConnection) {
          ((BaseConnection) conn).unregisterBasicScope(bsScope);
        }
      }
      stream.close();
    }
    conn.unreserveStreamId(streamId);
  }
View Full Code Here

    if (!(conn instanceof IStreamCapableConnection)) {
      return;
    }
    IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
    int streamId = getCurrentStreamId();
    IClientStream stream = streamConn.getStreamById(streamId);
    if (stream == null || !(stream instanceof ISubscriberStream)) {
      return;
    }
    ISubscriberStream subscriberStream = (ISubscriberStream) stream;
    // pausePlayback can be "null" if "pause" is called without any parameters from flash
View Full Code Here

          return;
        }
      }
    }
   
    IClientStream stream = streamConn.getStreamById(streamId);
    boolean created = false;
    if (stream == null) {
      stream = streamConn.newPlaylistSubscriberStream(streamId);
      stream.start();
      created = true;
    }
    if (!(stream instanceof ISubscriberStream)) {
      return;
    }
    ISubscriberStream subscriberStream = (ISubscriberStream) stream;
    SimplePlayItem item = new SimplePlayItem();
    item.setName(name);
    item.setStart(start);
    item.setLength(length);
    if (subscriberStream instanceof IPlaylistSubscriberStream) {
      IPlaylistSubscriberStream playlistStream = (IPlaylistSubscriberStream) subscriberStream;
      if (flushPlaylist) {
        playlistStream.removeAllItems();
      }
      playlistStream.addItem(item);
    } else if (subscriberStream instanceof ISingleItemSubscriberStream) {
      ISingleItemSubscriberStream singleStream = (ISingleItemSubscriberStream) subscriberStream;
      singleStream.setPlayItem(item);
    } else {
      // not supported by this stream service
      return;
    }
    try {
      subscriberStream.play();
    } catch (IOException err) {
      if (created) {
        stream.close();
        streamConn.deleteStreamById(streamId);
      }
      sendNSFailed((RTMPConnection) streamConn, err.getMessage(), name, streamId);
    }
  }
View Full Code Here

      if (!(conn instanceof IStreamCapableConnection)) {
        return;
      }
      IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
      int streamId = getCurrentStreamId();
      IClientStream stream = streamConn.getStreamById(streamId);
      if (stream != null) {
        stream.stop();
      }
    }
  }
View Full Code Here

      if (!(conn instanceof IStreamCapableConnection)) {
        return;
      }
      IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
      int streamId = getCurrentStreamId();
      IClientStream stream = streamConn.getStreamById(streamId);
      if (!(stream instanceof IBroadcastStream)) {
        return;
      }
      IBroadcastStream bs = (IBroadcastStream) stream;
      if (bs.getPublishedName() == null) {
View Full Code Here

      Channel channel = ((RTMPConnection) streamConn).getChannel((byte) (4 + ((streamId-1) * 5)));
      channel.sendStatus(badName);
      return;
    }

    IClientStream stream = streamConn.getStreamById(streamId);
    if (stream != null && !(stream instanceof IClientBroadcastStream)) {
      return;
    }
    boolean created = false;
    if (stream == null) {
View Full Code Here

TOP

Related Classes of org.red5.server.api.stream.IClientStream

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.