Package org.red5.server.net.rtmp.status

Examples of org.red5.server.net.rtmp.status.Status


        /**
         * Send resume status notification
         * @param item            Playlist item
         */
    private void sendResumeStatus(IPlayItem item) {
      Status resume = new Status(StatusCodes.NS_UNPAUSE_NOTIFY);
      resume.setClientid(getStreamId());
      resume.setDetails(item.getName());

      StatusMessage resumeMsg = new StatusMessage();
      resumeMsg.setBody(resume);
      doPushMessage(resumeMsg);
    }
View Full Code Here


        /**
         * Send published status notification
         * @param item            Playlist item
         */
    private void sendPublishedStatus(IPlayItem item) {
      Status published = new Status(StatusCodes.NS_PLAY_PUBLISHNOTIFY);
      published.setClientid(getStreamId());
      published.setDetails(item.getName());

      StatusMessage unpublishedMsg = new StatusMessage();
      unpublishedMsg.setBody(published);
      doPushMessage(unpublishedMsg);
    }
View Full Code Here

        /**
         * Send unpublished status notification
         * @param item            Playlist item
         */
    private void sendUnpublishedStatus(IPlayItem item) {
      Status unpublished = new Status(StatusCodes.NS_PLAY_UNPUBLISHNOTIFY);
      unpublished.setClientid(getStreamId());
      unpublished.setDetails(item.getName());

      StatusMessage unpublishedMsg = new StatusMessage();
      unpublishedMsg.setBody(unpublished);
      doPushMessage(unpublishedMsg);
    }
View Full Code Here

        /**
         * Stream not found status notification
         * @param item            Playlist item
         */
    private void sendStreamNotFoundStatus(IPlayItem item) {
      Status notFound = new Status(StatusCodes.NS_PLAY_STREAMNOTFOUND);
      notFound.setClientid(getStreamId());
      notFound.setLevel(Status.ERROR);
      notFound.setDetails(item.getName());

      StatusMessage notFoundMsg = new StatusMessage();
      notFoundMsg.setBody(notFound);
      doPushMessage(notFoundMsg);
    }
View Full Code Here

        /**
         * Insufficient bandwidth notification
         * @param item            Playlist item
         */
    private void sendInsufficientBandwidthStatus(IPlayItem item) {
      Status insufficientBW = new Status(StatusCodes.NS_PLAY_INSUFFICIENT_BW);
      insufficientBW.setClientid(getStreamId());
      insufficientBW.setLevel(Status.WARNING);
      insufficientBW.setDetails(item.getName());
      insufficientBW.setDesciption("Data is playing behind the normal speed.");

      StatusMessage insufficientBWMsg = new StatusMessage();
      insufficientBWMsg.setBody(insufficientBW);
      doPushMessage(insufficientBWMsg);
    }
View Full Code Here

    }
   
    IBroadcastScope bsScope = getBroadcastScope(scope, name);
    if (bsScope != null && !bsScope.getProviders().isEmpty()) {
      // Another stream with that name is already published.
      Status badName = new Status(StatusCodes.NS_PUBLISH_BADNAME);
      badName.setClientid(streamId);
      badName.setDetails(name);
      badName.setLevel("error");

      // FIXME: there should be a direct way to send the status
      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) {
      stream = streamConn.newBroadcastStream(streamId);
      created = true;
    }

    IClientBroadcastStream bs = (IClientBroadcastStream) stream;
    try {
      bs.setPublishedName(name);
      IContext context = conn.getScope().getContext();
      IProviderService providerService = (IProviderService) context
          .getBean(IProviderService.BEAN_NAME);
      // TODO handle registration failure
      if (providerService.registerBroadcastStream(conn.getScope(),
          name, bs)) {
        bsScope = getBroadcastScope(conn.getScope(), name);
        bsScope.setAttribute(IBroadcastScope.STREAM_ATTRIBUTE, bs);
        if (conn instanceof BaseConnection) {
          ((BaseConnection) conn).registerBasicScope(bsScope);
        }
      }
      if (IClientStream.MODE_RECORD.equals(mode)) {
        bs.start();
        bs.saveAs(name, false);
      } else if (IClientStream.MODE_APPEND.equals(mode)) {
        bs.start();
        bs.saveAs(name, true);
      } else if (IClientStream.MODE_LIVE.equals(mode)) {
        bs.start();
      }
      bs.startPublishing();
    } catch (IOException e) {
      Status accessDenied = new Status(StatusCodes.NS_RECORD_NOACCESS);
      accessDenied.setClientid(streamId);
      accessDenied.setDesciption("The file could not be created/written to.");
      accessDenied.setDetails(name);
      accessDenied.setLevel("error");

      // FIXME: there should be a direct way to send the status
      Channel channel = ((RTMPConnection) streamConn).getChannel((byte) (4 + ((streamId-1) * 5)));
      channel.sendStatus(accessDenied);
      bs.close();
 
View Full Code Here

    }
    ISubscriberStream subscriberStream = (ISubscriberStream) stream;
    try {
      subscriberStream.seek(position);
    } catch (OperationNotSupportedException err) {
      Status seekFailed = new Status(StatusCodes.NS_SEEK_FAILED);
      seekFailed.setClientid(streamId);
      seekFailed.setDesciption("The stream doesn't support seeking.");
      seekFailed.setLevel("error");

      // FIXME: there should be a direct way to send the status
      Channel channel = ((RTMPConnection) streamConn).getChannel((byte) (4 + ((streamId-1) * 5)));
      channel.sendStatus(seekFailed);
    }
 
View Full Code Here

     * @param description
     * @param name
     * @param streamId
     */
    private void sendNSFailed(RTMPConnection conn, String description, String name, int streamId) {
    Status failed = new Status(StatusCodes.NS_FAILED);
    failed.setClientid(streamId);
    failed.setDesciption(description);
    failed.setDetails(name);
    failed.setLevel("error");

    // FIXME: there should be a direct way to send the status
    Channel channel = conn.getChannel((byte) (4 + ((streamId-1) * 5)));
    channel.sendStatus(failed);
    }
View Full Code Here

  /**
   * Sends publish start notifications
   */
  private void sendPublishStartNotify() {
    Status publishStatus = new Status(StatusCodes.NS_PUBLISH_START);
    publishStatus.setClientid(getStreamId());
    publishStatus.setDetails(getPublishedName());

    StatusMessage startMsg = new StatusMessage();
    startMsg.setBody(publishStatus);
    try {
      connMsgOut.pushMessage(startMsg);
View Full Code Here

  /**
   *  Sends publish stop notifications
   */
  private void sendPublishStopNotify() {
    Status stopStatus = new Status(StatusCodes.NS_UNPUBLISHED_SUCCESS);
    stopStatus.setClientid(getStreamId());
    stopStatus.setDetails(getPublishedName());

    StatusMessage stopMsg = new StatusMessage();
    stopMsg.setBody(stopStatus);
    try {
      connMsgOut.pushMessage(stopMsg);
View Full Code Here

TOP

Related Classes of org.red5.server.net.rtmp.status.Status

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.