使用 camera2 与不推荐使用的 Camera - 最佳实践是什么? [英] Use of camera2 versus deprecated Camera - what is best practice?

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

问题描述

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

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天全站免登陆