Skip to main content
Participant
February 2, 2012
Question

Handling NetStream

  • February 2, 2012
  • 1 reply
  • 904 views

I'm trying to publish live webcam feed, but I noticed something odd going on.

After a connection has been made to FMS a user can press a button to start streaming. The button will simply create a netstream and attach audio/video devices to the net stream and start publishing.

If that user wants to stop publishing I have a differernt button that assigns my netstream to null.  The reason why I do this is because I don't want the user to drop the connection to the server, just stop publishing.

What's weird is I think the way I'm handling netstream is causing odd things to happen in the Admin Console. If I have 2 users waiting to listen to a stream; I will have 2 clients subscribed to the stream.  When a new user comes in and wants to publish the live stream it doubles the clients already subscribed and gives them another client id that is handling the stream.  If the publisher then decides to stop publishing then it only removes 1 of the duplicated clients from the stream.

Here's an attempt at a visual of the admin console

Before Publishing:

AAAAAA   rtmp   bytesIn  bytesOut  <-- Viewer

AAAAAB   rtmp   bytesIn  bytesOut  <-- Viewer

After a user starts publishing:

AAAAAA   rtmp   bytesIn  bytesOut  <-- Viewer (Client ID made when a connection was made), no longer appears to be used

AAAAAB   rtmp   bytesIn  bytesOut  <-- Viewer (Client ID made when a connection was made), no longer appears to be used

AAAAAC   rtmp   bytesIn  bytesOut  <-- Publisher

AAAAAD   rtmp   bytesIn  bytesOut  <-- Duplicated Viewer that is playing the stream

AAAAAE   rtmp   bytesIn  bytesOut  <-- Duplicated Viewer that is playing the stream

After user stops publishing:

AAAAAA   rtmp   bytesIn  bytesOut  <-- Viewer (Client ID made when a connection was made), no longer appears to be used

AAAAAB   rtmp   bytesIn  bytesOut  <-- Viewer (Client ID made when a connection was made), no longer appears to be used

AAAAAC   rtmp   bytesIn  bytesOut  <-- Publisher

AAAAAE   rtmp   bytesIn  bytesOut  <-- Duplicated Viewer that was playing the stream

This topic has been closed for replies.

1 reply

Adobe Employee
February 3, 2012

Do you have a edge-origin set-up?

Also, do you have any application (main.asc) that may be doing the mpp (or creating new stream, which is playing the published live stream)

You may check access logs (key on time or client id) to find what these two duplicated viewer doing asking for and what's their ip etc..

Zach_LAuthor
Participant
February 3, 2012

No edge-orgin is set up.

Inside my main.asc when a stream is started I call application.broadcastmsg() to alert all users a stream is being published.

UPDATE:

I changed a lot of my code around and I got everything working now.

For my publishing side:

I'm publishing a stream and using ns.close() to close the stream.  I'm no longer using application.broadcastmsg() either anymore, I'm using netstream.send().

For my client side:

I've changed the code to use Video instead of FLVPlayback. I  tie my netstream to my video and have my netstream send functions listening.

New problem I'm having though is on my client side is I can't get a hold of my Video because of the following:

package {

     public class mainform {

          var video:Video;

          ...

          var cc = new CustomClient();

          ns.client = cc;

     }

}

class CustomClient {

     public  function started():void {

          How can I get ahold of my video?

     }

     public function stopped():void {

          How can I get ahold of my video?

     }

}