Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing the NetStream class how do I detect if I got a working video attached to it?
    primarykey
    data
    text
    <p>I'm building a video chat in flash and everything works really well, except for the part where I'm trying to detect if the other user is sending a working video stream.</p> <p>There's a couple of reasons why the other user isn't sending video.</p> <ol> <li>The other user got no camera</li> <li>The other user got a camera, but the camera is currently being occupied by another application(Skype, Photo Booth, Google Talk, etc.)</li> <li>The other user got a camera but hasn't allowed the use of his/hers camera.</li> <li><em>(Other unexpected problems I guess...)</em></li> </ol> <p>So how do I detect if the stream I receive from the other user is a black stream(because of the reasons above) using the NetStream class?</p> <p>The closest thing I have came up with is by adding a timer that polls the currentFps() function from the stream I receive from the other user. But so far this seems pretty unreliable because I might get <code>currentFps() == 0</code> and show an error because of this even though I actually got video from the stream in some cases. The reason for this is because I poll the API every 4 seconds for the currentFPS function and let's say at 00:00:04 I get "no video" according to the poll but at 00:00:05 the video kicks in, and therefor I need to wait until the next <em>tick</em> until the error message disappears</p> <p>This is what my current poll looks like</p> <pre><code>function subscribingStatusPoll(e:TimerEvent):void { if (subscribingStream.currentFPS == 0){ error.text = "No video found from the other user..." } else { error.text = ""; } } </code></pre> <p>This is the only <em>hack</em> I that I can come up with to detect this, but this is unreliable and I actually would prefer a way to instantly detect if the stream I receive got a working video attached to it without this ugly poll.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload