Here's a way on how to switch cameras on the fly, obviously you need to have
more than one camera for this to work.
In this experiment I used two logitech quickcam cameras.
Ok let's start by dragging an instance of the Avpresence and one of the Simple connect component onto the stage. Now right click on the AVpresence component and choose 'edit in place', then find line 139 of code and insert this piece of code:
FCAVPresenceClass.prototype.setCam = function()
{
this.ActiveCam = 0;
};
FCAVPresenceClass.prototype.activeCam = function(cam) {
this.ActiveCam = cam;
};
Now find the startPublish prototype method (somewhere around line 145),
it looks like this: FCAVPresenceClass.prototype.startPublish
You'll see two Camera.get() codes,
replace them with Camera.get(this.activeCam);
and on the init prototype (line 28) put this code
this.setCam();
Now on a new layer inside the component, put a new movie clip and inside
the movie clip insert 2 buttons with instance names cam1 and cam2.
Next insert this code on the first frame on the movie clip that contains
the button instances cam1 and cam2:
cam1.onPress = function() {
_parent.stopPublish();
};
cam1.onRelease = function() {
_parent.ActiveCam = 0;
_parent.startPublish();
};
cam2.onPress = function() {
_parent.stopPublish();
};
cam2.onRelease = function() {
_parent.ActiveCam = 1;
_parent.startPublish();
};
I needed to change _parent.ActiveCam = 1; to _parent.ActiveCam = 2; for the application to pick up both cams so watch out as your camindex might differ.
And that's all!
Cheers!
