actionscript 3 - Checking if video is attached to netstream -


i'm working on video chat application , i'm building feature starts call can switch call audio call. receiver gets link call , when join call application gets camera , microphone , attach netstream. want if initiator if call turns camera off when starting call when receiver joins call, application shouldn't camera because no video attached netstream. have used netstream.info.videobytespersecond since opposing video , audio doesn't start when receiver joins call (there 3-4 second delay) function keeps returning 0 @ start of call whether or not netstream has video attached or not.

this did

public function checkvideo():number        {          hey=_incomingstream.info.videobytecount;         return hey;     }  if(_outgoingstream && _incomingstream!=null ){                 if(checkvideo()>0)                 _outgoingstream.attachcamera(camera);                 else                     _outgoingstream.attachcamera(null);   

it didn't work.

next read netstream.send() function , idea when user initiates call he/she send @ message in netstream flag true if user initiated video call or false if user initiated audio call. when receiver joins if flag false camera won't initiated if flag true camera initiated.

when implemented it, didn't work. don't know if there did wrong while implementing.

 if(camera && !mutecam )         {//initate call             camera = setcameraquality(camera);             yourvidholder.attachcamera(camera);              if(_outgoingstream && _incomingstream==null){                 _outgoingstream.attachcamera(camera);  _outgoingstream.send("flagvideo", true);  ---------------------------------------------------------------------------------- public function flagv():boolean     {          _incomingstream.client.flagvideo=function(flag:boolean):void{             check=flag;         }                return check;     }   if(_outgoingstream && _incomingstream!=null ){                 if(checkvideo()>0)                 _outgoingstream.attachcamera(camera);                 else                     _outgoingstream.attachcamera(null);                 }  

but can't work. can me out please? maybe there better way check if netstream has video attached it?

i got work. used netstreaminfo.videobytecount property work. check videobytes coming in after incoming stream loaded on receiver's end. if bytes equal zero, receiver's camera won't turn on.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -