problem unsubscribing streamingproxy from stream

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

problem unsubscribing streamingproxy from stream

Juan Diego
Hi,

I want to have an output stream where my users subscribe.  I am using StreamingProxy to restream an already published stream.  And it works, the problem is that when I want to subscribe to another stream both Streams get mixed together.

I am trying to unsubcribe first but it is not working.

This is my code,

public void publishVideo(String streamName) {
       
        if(streamer != null && streamPublicado != null){
            String namePublishedStream = streamPublicado.getPublishedName();
            StreamingProxy proxy = streamingProxyMap.get(namePublishedStream);
            if (proxy != null) {
                log.info("Paramos el streamer "+streamPublicado.getPublishedName());
                proxy.stop();
                IScope scope = streamPublicado.getScope();
                IBroadcastScope bsScope = getBroadcastScope(scope, namePublishedStream);
                if (bsScope != null) {
                    log.info("Desubscribimos ");
                    bsScope.unsubscribe(proxy);
                }
                streamingProxyMap.remove(namePublishedStream);
                streamPublicado = null;
            }
           
        }

        log.info("Publicar Video: " + streamName);
        streamPublicado = getBroadcastStream(appScope, streamName);

        IScope scope = streamPublicado.getScope();
        IBroadcastScope bsScope = getBroadcastScope(scope, streamPublicado.getPublishedName());
        if(streamer == null){
            streamer = new StreamingProxyRamona();
        }
       
        streamer.setHost("localhost");
        streamer.setApp("ramona");
        streamer.setPort(1935);
        streamer.init();

        // Si subscribe que funque
        bsScope.subscribe(streamer, null);

        streamer.start(output, "live", null);

        streamingProxyMap.put(streamPublicado.getPublishedName(), streamer);

        streamPublicado.addStreamListener(this);

        log.info(streamer.getEstado().name());

    }

There is some nonsense code around this because I was trying anything that I could think of to make it work.

Is my approach to unsuscribe ok?

--

---
You received this message because you are subscribed to the Google Groups "red5" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.