I have a situation where I have to a have a few different sized “cameras” to send over a netstream depending on if its a desktop or mobile connected. Here’s how I have it setup:
protected var nearCam:Camera;
protected var nearCamForMobile:Camera;
nearCam = Camera.getCamera();
nearCam.setMode(385,240,10);
nearCam.setQuality(0,0);
//this is the cam I want to display on the near Side to show the user themselves.
near_video.attachCamera(nearCam);
//If a mobile user connects, I want to send them this resolution/aspect ratio of a camera so i'm just setting up this Camera but not showing it anywhere.
nearCamForMobile = Camera.getCamera();
nearCamForMobile.setMode(480,800,10);
nearCamForMobile.setQuality(0,0);
So when a mobile user connected I’d just swap the camera that’s attached to the netstream to the mobile one so it looks good on their phone and not all stretched.
if(isFarMobile)
{
sendStream.attachCamera(nearCamForMobile);
}
else
{
sendStream.attachCamera(nearCam);
}
Now on to my problem….
If i do JUST the nearCamForMobile and send that to the mobile versaion it looks great on the phone and it’s not stretched. but then obviously its 480×800 resolution looks stretched on the desktop version which is a 385×240 video box. So if i do just the nearCam it looks great on the desktop but then it looks stretched on the mobile….
So what im curious is why Cant I do both vars the way I showed above, display the nearCam, and then have the nearCamForMobile waiting to be sent when i need it to?
Can you only have one camera mode setup at a time? Any ideas how I could do this? On the mobile version its setup so the user is holding the phone in potrait and its 840×480. The desktop site looks best when its like a widescreen video.
In the end I’m basically trying to figure out how to have 2 camera vars with 2 resolutions. Display 1 on the near side and attach the other to the netstream in a situation where the far is a mobile client. (I know how to figure out if the far is mobile, im not worried about that part)
I just need to be able to transmit a resolution/aspect ratio that looks good for a mobile client. which happens to be in a different aspect ratio than the desktop cleint.
Can’t be done. Check out this line specifically from the docs :
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#getCamera()
So in other words, as soon as you get one, any subsequent get attempts will just be creating another pointer to the same object. Thus, you have two variables with a pointer to the same object. Setting a property on that pointer sets it to both.
Make sense?
Sorry for the bad news :\