gpt4 book ai didi

android - Webrtc 支持 Android 5.0

转载 作者:行者123 更新时间:2023-11-30 00:34:31 24 4
gpt4 key购买 nike

我正在开发一个 webrtc 应用程序。我发现 webrtc 不支持 android 5.0(api 级别 21)。这是我从 webrtc 库 (libjingle) 获得的代码:

  /**
* Checks if API is supported and all cameras have better than legacy support.
*/
public static boolean isSupported(Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return false;
}

CameraManager cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);
try {
String[] cameraIds = cameraManager.getCameraIdList();
for (String id : cameraIds) {
CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(id);
if (characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)
== CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
return false;
}
}
// On Android OS pre 4.4.2, a class will not load because of VerifyError if it contains a
// catch statement with an Exception from a newer API, even if the code is never executed.
// https://code.google.com/p/android/issues/detail?id=209129
} catch (/* CameraAccessException */ AndroidException e) {
Logging.e(TAG, "Camera access exception: " + e);
return false;
}
return true;
}

它总是返回 false,因为 Android 5.0 的 INFO_SUPPORTED_HARDWARE_LEVEL 是 INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY。所以我不能使用相机捕获本地媒体流。

有人帮我吗?

最佳答案

我已经为 android 实现了 webRTC,它也支持 lollipop 和 marshmallow,请查看 link

关于android - Webrtc 支持 Android 5.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43647893/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com