使用 camera2 与已弃用的 Camera - 最佳做法是什么? [英] Use of camera2 versus deprecated Camera - what is best practice?

查看:26
本文介绍了使用 camera2 与已弃用的 Camera - 最佳做法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,其中相机是必不可少的功能.对此,我想百分百确定以下几个方面:

I'm writing an app for which the camera is an essential feature. In this regard I want to be 100% certain about the following aspects:

  1. 如果我使用已弃用的相机:该应用是否仍可在所有 API 上运行现在?
  2. 如果 1) 为是":此应用在什么时间点不会运行不再适用于所有 API(我的应用应涵盖最低 API 17)?
  3. 我在哪里可以找到有关 2) 的最新官方信息,即计划内容和时间?
  4. 说,我现在已经在使用新的 camera2,我的理解是该应用程序会不能在低于 21 的任何 API 上运行 - 对吗?
  5. 根据我目前获得的信息,我的工作假设是:现在仍在使用已弃用的相机.但请继续关注 API 的市场份额,并尽快开始学习 camera2,以便在未来 2-3 年内将应用程序切换到 camera2.你同意吗?

无论如何,使用设备的摄像头并使其在几乎所有目标设备上运行都非常棘手(因为现在我很高兴掌握了旧"摄像头......).因此,我真的很想确定以上几点.非常感谢您的回答.

In any case, the use of a device's camera and making it run on virtually all targeted devices is tricky enough (as for now I am happy to have mastered the "old" Camera...). Therefore, I really want to be sure about the above points. Many thanks for your answers.

推荐答案

如果我使用已弃用的相机:该应用现在是否仍可在所有 API 上运行?

If I use the deprecated camera: will the app still run on all APIs now?

是的.

什么时候此应用将不再在所有 API 上运行(我的应用应涵盖最低 API 17)?

At what point in time this app will not run anymore on all APIs (my app shall cover minimum API 17) ?

建造一台时间机器,进入未来,找出答案,然后让我们其他人知道.

Build a time machine, go into the future, find out, and let the rest of us know.

IOW,我们无法预测 Google 是否以及何时会完全停止使用此 API.话虽如此,他们几乎从不停止使用 API.

IOW, we have no way of predicting if and when Google might discontinue this API entirely. That being said, they almost never discontinue APIs.

我在哪里可以找到有关 2) 的最新官方信息,即计划内容和时间?

Where can I find updated official information about 2), i.e. what is planned and by when?

在 Google 找到一份工作,或者选择上述时间机器选项.Google 没有提前公布计划的习惯,他们的时光机也没有出租.

Get a job with Google, or go with the aforementioned time machine option. Google is not in the habit of announcing plans in advance, and their time machine is not available for rental.

(虽然 Elon Musk 的特斯拉可能配备了 Mr. Fusion,所以你可以联系他...)

(though Elon Musk probably has a Tesla outfitted with a Mr. Fusion, so you could reach out to him...)

我现在已经在使用新的 camera2,我的理解是该应用无法在低于 21 的任何 API 上运行 - 对吗?

I would use the new camera2 already now, my understanding is that the app would not run on any API below 21 - correct?

正确.

现在仍然使用已弃用的相机.但请继续关注 API 的市场份额,并尽快开始学习 camera2,以便在未来 2-3 年内将应用程序切换到 camera2.你同意吗?

NOW still use the the deprecated Camera. But Keep watching market shares of APIs and start learning camera2 soon, in order to be ready to switch the app to camera2 within the next 2-3 years. Do you agree?

不,原因我会在你的下一次报价后澄清.

No, for reasons I will clarify after your next quote.

使用设备的摄像头并让它在几乎所有目标设备上运行已经够棘手的了

the use of a device's camera and making it run on virtually all targeted devices is tricky enough

这种棘手的部分原因是设备制造商的相机实现可能被大方地描述为古怪".

Part of that trickiness is the fact that device manufacturers have camera implementations that might be generously described as "quirky".

完全坚持使用旧相机 API 的问题在于,我预计该 API 的质量控制会稳步下降.设备制造商在相机方面的有限资源将主要用于新 API.

The problem with sticking with the old camera API exclusively is that I expect quality control on that API to steadily decline. What limited resources device manufacturers have for cameras primarily will be devoted to the new API.

因此,我的建议是同时使用这两种 API:尽可能使用 camera2 并在需要时回退到原始 API.诚然,这需要更多的工作.如果您无法完成这项工作,那么您别无选择,只能坚持使用原始相机 API,直到您准备好将 minSdkVersion 设为 21+.

Hence, my recommendation is to use both APIs: using camera2 where possible and falling back to the original API where needed. Admittedly, this requires substantially more work. If you are not in position to do that work, then you have no choice but to stick with the original camera API until such time as you are ready to have your minSdkVersion be 21+.

这篇关于使用 camera2 与已弃用的 Camera - 最佳做法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆