Examples of IBroadcastScope


Examples of org.red5.server.api.scope.IBroadcastScope

  /** {@inheritDoc} */
  public IBroadcastStream getBroadcastStream(IScope scope, String name) {
    IStreamService service = (IStreamService) ScopeUtils.getScopeService(scope, IStreamService.class, StreamService.class);
    if (service instanceof StreamService) {
      IBroadcastScope bs = ((StreamService) service).getBroadcastScope(scope, name);
      if (bs != null) {
        return bs.getClientBroadcastStream();
      }
    }
    return null;
  }
View Full Code Here

Examples of org.red5.server.api.scope.IBroadcastScope

      ((IStreamCapableConnection) conn).reserveStreamId(streamId);
      IClientStream stream = ((IStreamCapableConnection) 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();
View Full Code Here

Examples of org.red5.server.api.scope.IBroadcastScope

      IClientStream stream = scConn.getStreamById(streamId);
      if (stream != null) {
        if (stream instanceof IClientBroadcastStream) {
          // this is a broadcasting stream (from Flash Player to Red5)
          IClientBroadcastStream bs = (IClientBroadcastStream) stream;
          IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
          if (bsScope != null && conn instanceof BaseConnection) {
            ((BaseConnection) conn).unregisterBasicScope(bsScope);
          }
        }
        stream.close();
View Full Code Here

Examples of org.red5.server.api.scope.IBroadcastScope

  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();
View Full Code Here

Examples of org.red5.server.api.scope.IBroadcastScope

        int streamId = conn.getStreamId();
        IClientStream stream = streamConn.getStreamById(streamId);
        if (stream instanceof IBroadcastStream) {
          IBroadcastStream bs = (IBroadcastStream) stream;
          if (bs.getPublishedName() != null) {
            IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
            if (bsScope != null) {
              bsScope.unsubscribe(bs.getProvider());
              if (conn instanceof BaseConnection) {
                ((BaseConnection) conn).unregisterBasicScope(bsScope);
              }
            }
            bs.close();
View Full Code Here

Examples of org.red5.server.api.scope.IBroadcastScope

            sendNSFailed(streamConn, StatusCodes.NS_PUBLISH_BADNAME, "You are not allowed to publish the stream.", name, streamId);
            return;
          }
        }
      }
      IBroadcastScope bsScope = getBroadcastScope(scope, name);
      if (bsScope != null && !bsScope.getProviders().isEmpty()) {
        // another stream with that name is already published     
        sendNSFailed(streamConn, StatusCodes.NS_PUBLISH_BADNAME, name, name, streamId);
        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 {
        // set publish name
        bs.setPublishedName(name);
        // set stream parameters if they exist
        if (params != null) {
          bs.setParameters(params);
        }
        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.setClientBroadcastStream(bs);
          if (conn instanceof BaseConnection) {
            ((BaseConnection) conn).registerBasicScope(bsScope);
          }
        }
        log.debug("Mode: {}", mode);
View Full Code Here

Examples of org.red5.server.api.scope.IBroadcastScope

    //state.setWriteChunkSize(requestedChunkSize);
    // set on each of the streams
    for (IClientStream stream : conn.getStreams()) {
      if (stream instanceof IClientBroadcastStream) {
        IClientBroadcastStream bs = (IClientBroadcastStream) stream;
        IBroadcastScope scope = bs.getScope().getBroadcastScope(bs.getPublishedName());
        if (scope == null) {
          continue;
        }
        OOBControlMessage setChunkSize = new OOBControlMessage();
        setChunkSize.setTarget("ClientBroadcastStream");
        setChunkSize.setServiceName("chunkSize");
        if (setChunkSize.getServiceParamMap() == null) {
          setChunkSize.setServiceParamMap(new HashMap<String, Object>());
        }
        setChunkSize.getServiceParamMap().put("chunkSize", requestedChunkSize);
        scope.sendOOBControlMessage((IConsumer) null, setChunkSize);
        log.debug("Sending chunksize {} to {}", chunkSize, bs.getProvider());
      }
    }
  }
View Full Code Here

Examples of org.red5.server.api.scope.IBroadcastScope

  /** {@inheritDoc} */
  public IMessageInput getLiveProviderInput(IScope scope, String name, boolean needCreate) {
    log.debug("Get live provider input for {} scope: {}", name, scope);
    //make sure the create is actually needed
    IBroadcastScope broadcastScope = scope.getBroadcastScope(name);
    if (broadcastScope == null) {
      if (needCreate) {
        synchronized(scope) {
          // re-check if another thread already created the scope
          broadcastScope = scope.getBroadcastScope(name);
View Full Code Here

Examples of org.red5.server.api.scope.IBroadcastScope

  /** {@inheritDoc} */
  public boolean registerBroadcastStream(IScope scope, String name, IBroadcastStream bs) {
    log.debug("Registering - name: {} stream: {} scope: {}", new Object[] { name, bs, scope });
    ((Scope) scope).dump();
    IBroadcastScope broadcastScope = scope.getBroadcastScope(name);
    if (broadcastScope == null) {
      log.debug("Creating a new scope");
      broadcastScope = new BroadcastScope(scope, name);
      if (scope.addChildScope(broadcastScope)) {
        log.debug("Broadcast scope added");
      } else {
        log.warn("Broadcast scope was not added to {}", scope);
      }
    }
    log.debug("Subscribing scope {} to provider {}", broadcastScope, bs.getProvider());
    return broadcastScope.subscribe(bs.getProvider(), null);
  }
View Full Code Here

Examples of org.red5.server.api.scope.IBroadcastScope

  /** {@inheritDoc} */
  public boolean unregisterBroadcastStream(IScope scope, String name, IBroadcastStream bs) {
    log.debug("Unregistering - name: {} stream: {} scope: {}", new Object[] { name, bs, scope });
    ((Scope) scope).dump();
    IBroadcastScope broadcastScope = scope.getBroadcastScope(name);
    if (bs != null) {
      log.debug("Unsubscribing scope {} from provider {}", broadcastScope, bs.getProvider());
      broadcastScope.unsubscribe(bs.getProvider());
    }
    // if the scope has no listeners try to remove it
    if (!((BasicScope) broadcastScope).hasEventListeners()) {
      log.debug("Scope has no event listeners attempting removal");
      scope.removeChildScope(broadcastScope);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.