如何设置多种相机模式flex?

发布于 2024-11-25 02:45:21 字数 1339 浏览 0 评论 0原文

我遇到的情况是,我必须有几个不同大小的“相机”来通过网络流发送,具体取决于它是连接的是台式机还是移动设备。我的设置方式如下:

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);

因此,当移动用户连接时,我只需将连接到网络流的摄像头交换到移动摄像头,这样它在手机上看起来就很好,而不是全部拉伸。

if(isFarMobile)
{
    sendStream.attachCamera(nearCamForMobile);
}
else
{
    sendStream.attachCamera(nearCam);
}

现在解决我的问题......

如果我只执行nearCamForMobile并将其发送到移动版本,它在手机上看起来很棒并且不会被拉伸。但显然它的 480x800 分辨率在桌面版本(385x240 视频盒)上显得有些拉伸。所以,如果我只做nearCam,它在桌面上看起来很棒,但在移动设备上看起来很拉伸......

所以我好奇的是为什么我不能按照上面显示的方式做这两个变量,显示nearCam,然后让closeCamForMobile 等待在我需要时发送?

一次只能设置一种相机模式吗?我有什么想法可以做到这一点吗?在移动版本上,其设置为用户将手机纵向握持,分辨率为 840x480。当桌面网站像宽屏视频时看起来最好。

最后,我基本上想弄清楚如何拥有 2 个具有 2 个分辨率的相机变量。在远端是移动客户端的情况下,在近端显示 1,并将另一个附加到网络流。 (我知道如何确定远端是否是移动的,我不担心那部分)

我只需要能够传输适合移动客户端的分辨率/宽高比。它的纵横比恰好与桌面客户端不同。

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 480x800 resolution looks stretched on the desktop version which is a 385x240 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 840x480. 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

困倦 2024-12-02 02:45:21

做不到。特别从文档中查看这一行:

“多次调用 getCamera() 方法引用同一相机
司机。因此,如果您的代码包含诸如firstCam:Camera =之类的代码
getCamera() 和 secondaryCam:Camera = getCamera(),firstCam 和
secondaryCam 引用同一个相机,这是用户的默认值
相机。”

http://help. adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#getCamera()

换句话说,一旦您获得一个,任何后续的获取尝试都将只是创建因此,您有两个带有指向同一对象的指针的变量,将其设置为两个都有

吗?

意义

Can't be done. Check out this line specifically from the docs :

"Multiple calls to the getCamera() method reference the same camera
driver. Thus, if your code contains code like firstCam:Camera =
getCamera() and secondCam:Camera = getCamera(), both firstCam and
secondCam reference the same camera, which is the user's default
camera."

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 :\

梦中的蝴蝶 2024-12-02 02:45:21

如果您使用的是 Flash Builder 4.5,则可以通过调用 CameraUI 而不是 Camera 来检查是否正在访问移动相机。您可以通过如下编码来检查您拥有哪种类型的相机:

if(CameraUI.isSupported)
{
    //Mobile camera
}
else
{
    //Desktop camera
}

您可以在此链接中找到更多信息:http://www.flex-tutorial.fr/2010/09/07/air-android-prendre-des-photos-videos-avec-cameraui/

希望这有帮助:)

If you are using Flash Builder 4.5, you can check whether or not you are accessing a mobile Camera by calling for CameraUI instead of Camera. You can check which type of camera you have by coding it like this:

if(CameraUI.isSupported)
{
    //Mobile camera
}
else
{
    //Desktop camera
}

You can find more information at this link: http://www.flex-tutorial.fr/2010/09/07/air-android-prendre-des-photos-videos-avec-cameraui/

Hope this helps :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文