Groups | Blog | Home
all groups > macromedia flash flashcom > may 2005 >

macromedia flash flashcom : Not accessing camera


choad_man
5/10/2005 12:00:00 AM
You might need to loop through the available cameras on you system.

FROM MACROMEDIA HELP DOCUMENTATION

Camera.get([index]);

If index is not specified, this method returns a reference to the default
camera or, if it is in use by another application, to the first available
camera. (If there is more than one camera installed, the user may specify the
default camera in the Flash Player Camera Settings panel.) If no cameras are
available or installed, the method returns null.

Other than that, if what you are trying to do is read the same camera from two
different applications, I do not think that flash can support this. I have
heard of 3rd party products that allow a single camera feed to be shared across
multiple applications though, so this might be worth looking into.

Hope this helps,

Let me know
bobelzzib
5/10/2005 12:00:00 AM
All right, I have been working with Flash Streaming video for awhile. My
recorder, or publish, file works great and I can capture video and stream it to
the server. My company purchased a NiagaraMAX portable system specifically for
recording video and streaming. However, it has two capture cards. The capture
card recognizes the camera, as I can capture directly from that. However when
the Flash application opens, and I allow it access to the camera, no picture
appears. I right-clicked, and went to settings, and saw that the camera
settings had two options for which card to record from, so I chose the one the
camera was connected to, but still no image is there. So, in summary, on our
machine with one capture card, it automatically recognizes the camera with
Flash, and I can start recording, but on the machine with two cards, it doesn't
seem to find it, even though it seems to know there are two capture cards, and
it is set on the one it is connected to. Is there any action script I need to
include in the .fla file that will remedy the problem? I am at a loss!

Thanks,
Bob
bobelzzib
5/11/2005 12:00:00 AM
Thanks choad...

I already specified which camera through the flash player camera settings. I
only have one camera hooked up. It is hooked up to one video capture card, but
this machine as a second video capture card below it. In my actionscript, I
just have this:

// attach the camera feed to the video monitor; (cam_video)
activeCamera=Camera.get();
activeCamera.setKeyFrameInterval(30);
activeCamera.setMode(640, 480, 15, true);
activeCamera.setQuality(288000, 70);
activeCamera.setLoopback(true);
cam_video.attachVideo(activeCamera);
activeMicrophone=Microphone.get();
// more stuff here...
// now let's start recording...
startPublish = function(){
// Assign a new NetStream to publish_ns, and attach this stream to the
NetConnection, myConnection_nc
publish_ns = new NetStream(myConnection_nc);
publish_ns.onStatus = function(info){
trace("LEVEL: " + info.level + " CODE: " + info.code);
};
webcast = webcast_txt.text;
// Attach the video source to the stream
publish_ns.attachVideo(Camera.get());
// Find and attach any audio source to the same stream
publish_ns.attachAudio(Microphone.get());

Now, moving the camera to a different computer with only one video capture
card, this same recorder/publisher application works fine. It show the camera
picture before you start publishing.

On the box with two cards, I moved the camera to the second video capture card
to see if that would work, but it doesn't appear to change anything.

Any other suggestions/

Bob


publish_ns.publish(webcast, "record");
choad_man
5/11/2005 12:00:00 AM
//STILL CONFUSED A BIT WITH YOUR PROBLEM
//MIGHT WANT TO TRY THIS FIRST
//I HAVE ATTACHED TWO VIDEO OBJECTS TO THE STAGE - my_video_1 and my_video_2
//THIS WAY I CAN SEE WHETHER I AM FAILING ON THE CAMERA.GET OR IF I AM FAILING
ON THE PUBLISH
//I CAPTURE THE CAMERA OBJECT AND PLACE IN VIDEO_1
//I THEN PUBLISH THIS VIDEO
//I THEN SUBSCRIBE TO THAT STREAM AND PLACE IN VIDEO_2


my_video_1.attachVideo(Camera.get());
my_video_1.attachAudio(Microphone.get());
this.my_name = "my_test";
this.outstream_ns = new NetStream(this.connection_nc);
this.instream_ns = new NetStream(this.connection_nc);

this.outstream_ns.publish(this.my_name,"live");

this.outstream_ns.attachVideo(Camera.get());
this.outstream_ns.attachAudio(Microphone.get());

my_video_2.attachVideo(this.instream_ns);
this.instream_ns.play(this.my_name);

//THIS MIGHT HELP, IF YOU CAN GET THE VIDEO IN VIDEO_1 THEN YOU KNOW THAT YOUR
CAMERA IS WORKING



The only other thing I can think of is when you select your camera in the
flash player settings, you should be able to click on the box with the camera
picture in it and then see a mini display what the camera is viewing.

Another thing I thought of is do you have any kind of detection for whether
the camera is muted or anything of the like. Maybe the broswer has secuity
settings or something of the like that is overriding it. Try somethng like
this to disect this a little more before you even try and broadcast.


my_cam = Camera.get();
my_cam._parent = this;
this.camera_test = false;
this.camera_enabled = false;

this.my_video.my_video.attachVideo(my_cam);

if (my_cam == "" || my_cam == null || my_cam == undefined){
this._visible = false;
this.camera_test = true;
trace("THERE IS NO CAMERA OBJECT");
}
my_cam.onStatus = function(infoObj){
if (my_cam.muted){
this._parent.camera_test = true;
trace("CAMERA IS MUTED SO IT WILL NOT PLAY");
}
};
my_cam.onActivity = function(activity){
if (this._parent.camera_test == false){
this._parent.camera_test = true;
if (my_cam.activityLevel > -1){
this._parent.camera_enabled = true;
trace("CAMERA SHOULD WORK");
} else {
trace("CAMERA IS NOT ACTIVE");
}
}
}


bobelzzib
5/12/2005 12:00:00 AM
Since the flash application is running on a computer without Flash Professional
MX installed, I can't see the trace, so I changed it to:

error_txt.text = "CAMERA IS MUTED SO IT WILL NOT PLAY"
etc.

but no message ever appears in my error_txt text box component.
When I click on the little camera in the flash player settings, I just see
white. Nothing is there.
If I don't have a trace output box, how can I see my error messages, to try
and solve this.

Also, with using two video objects, I get nothing. I know the camera is
working, because if I go into the software that came with the Osprey Video
Capture Cards (there's a 540/560 and a 230) both of them work to capture the
video. I just can't seem to figure out why I can't get the picture through the
flash application, when this same application works great on another computer
that just has the one Osprey 540/560 card.

Does this help you understand any better?

Bob

bobelzzib
5/12/2005 4:52:38 PM
Choad,

Okay, I do not have a Flash problem, it is a video driver problem with the
capture card. The other machine's capture card had an older driver, and when I
upgraded to the new one, it does not work with Flash. The machine with two
capture cards had the newer version of the driver, that;s why I wasn't getting
a picture with Flash. I was getting sound through the camera though!

So, thank you for all your help, Choad!

Bob
AddThis Social Bookmark Button