Webrtc支持Android 5.0
问题描述:
我正在开发一个webrtc应用程序。我发现webrtc不支持android 5.0(api level 21)。下面是代码,我从图书馆的WebRTC得到(设的Libjingle):Webrtc支持Android 5.0
/**
* 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。所以我不能使用相机捕捉本地媒体流。
有人帮我吗?
非常感谢。当我尝试在我的手机中运行.apk时,它无法工作,因为摄像头许可。我没有编译它。最后,我发现有人已经编译过它。 https://github.com/jitsi/react-native-webrtc https://github.com/oney/react-native-webrtc –