Now I have used netstream.info.Videobytespersecond but since the opposing video and audio doesn't start immediately when the receiver joins the call (There is like a 3-4 second delay) the function keeps returning 0 at the start of the call whether or not the netstream has a video attached to it or not.
This is what I did
Expand|Select|Wrap|Line Numbers
- public function checkVideo():Number {
- hey=_incomingStream.info.videoByteCount;
- return hey;
- }
- if(_outgoingStream && _incomingStream!=null ){
- if(checkVideo()>0)
- _outgoingStream.attachCamera(camera);
- else
- _outgoingStream.attachCamera(null);
Next I read about the netstream.send() function and so my idea was that when a user initiates a call he/she will send at message in the netstream which will basically flag true if the user initiated a video call or false if the user initiated an audio call. Then when the receiver joins if the flag is false their camera won't be initiated but if the flag is true the camera would be initiated.
When I implemented it, it didn't work. I don't know if there is something I did wrong while implementing.
Expand|Select|Wrap|Line Numbers
- if(camera && !muteCam )
Expand|Select|Wrap|Line Numbers
- {//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);
- }
Also maybe there is a better way I could check if the netstream has a video attached to it? Thanks!