473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Checking if video is attached to netstream

I'm working on a video chat application and I'm building a feature where someone who starts a call can switch the call to an audio call. Now the receiver gets a link for the call and when they join the call the application gets their camera and microphone and attach it to the netstream. What I want is if the initiator if the call turns his camera off when starting the call when the receiver who joins the call, the application shouldn't get the Camera because their is no video attached to the netstream.
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
  1. public function checkVideo():Number        {
  2.  
  3.             hey=_incomingStream.info.videoByteCount;
  4.             return hey;
  5.         }
  6.  
  7. if(_outgoingStream && _incomingStream!=null ){
  8.                     if(checkVideo()>0)
  9.                     _outgoingStream.attachCamera(camera);
  10.                     else
  11.                         _outgoingStream.attachCamera(null);    
  12.  
It didn't work.

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
  1. if(camera && !muteCam )
Expand|Select|Wrap|Line Numbers
  1.             {//Initate call
  2.                 camera = setCameraQuality(camera);
  3.                 yourVidHolder.attachCamera(camera);
  4.  
  5.                 if(_outgoingStream && _incomingStream==null){
  6.                     _outgoingStream.attachCamera(camera);
  7.    _outgoingStream.send("flagVideo", true);
  8.  
  9. ----------------------------------------------------------------------------------
  10. public function flagV():Boolean
  11.         {
  12.  
  13.             _incomingStream.client.flagVideo=function(flag:Boolean):void{
  14.                 check=flag;
  15.             }
  16.  
  17.  
  18.  
  19.                 return check;
  20.         }
  21.  
  22.  
  23. if(_outgoingStream && _incomingStream!=null ){
  24.                     if(checkVideo()>0)
  25.                     _outgoingStream.attachCamera(camera);
  26.                     else
  27.                         _outgoingStream.attachCamera(null);    
  28.                 }
  29.  
  30.  
  31.  
But I can't get it to work. Can anyone help me out please?
Also maybe there is a better way I could check if the netstream has a video attached to it? Thanks!
May 19 '13 #1
0 1645

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Help | last post by:
What are the parameters in the constructor if you are going to send a file over a tcp/ip network using netstream and filestream? I have learned that you are supposed to do something like this:...
7
by: fairyvoice | last post by:
i am writing a very simple c/s socket program, i just wanted the client to first write to the server, after server get the message it, write to the client, the the client write again. here's the...
2
by: wizardRahl | last post by:
Hello, I've just recently built a system for my family. I want to add an older video card that I've just had lying around. At the moment, it just has on-board 16mb video. I want to add the ATI...
1
by: michael | last post by:
Hello all, I have a Linksys WVC54GC network camera that I am trying to integrate into a website and to enable browsers other than IE to use. Linksys, in their ever-short-sighted ways, decided...
6
by: Daniel Padron | last post by:
Ok. Maybe I shouldnt post such basic questions here in such an advanced group but my high school programming teacher wont answer any questions outside of his curriculum :( My goal is create a...
1
by: Stwange | last post by:
I'm currently loading flv videos in swf using the NetStream, NetConnect(null) and Video objects, but how do I set the video to autorepeat? I can't find a method for it in any of the APIs for the...
0
by: eliana | last post by:
Hi i'm writing a simple player to stream a flv file; video streams fine but the netstream onstatus and the nestream onmetadata are not invoked. Any help? Here is my code: var nc:NetConnection =...
2
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
You're going to need to start with the driver for the camera - otherwise, your application might run into problems finding where the video is. Next, search (i.e. Google) into Twain Aquire...
2
by: Andycb | last post by:
Hi i'm realtively new to HTML, let alone HTML CSS but basicly, as the title suggests I want to know how to position a flash video in a particular part of the web page. I have attached a picture...
0
by: Meera Haridas | last post by:
I want to record audio and video from IP camera.i have attached my application here.By using that i can stream video and can save images continously,but iam not able to save video.anybody can help me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.