在某些 Android 手机中找不到相机分辨率 CamcorderProfile
Camera resolution CamcorderProfile not found in some Android phones
我有一个代码示例:
mediaRecorder = new MediaRecorder();
mediaRecorder.setPreviewDisplay(surfaceHolder.getSurface());
mediaRecorder.setCamera(camera);
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_480P));
这似乎工作正常,CamcorderProfile.QUALITY_LOW
但是当我尝试获取 360p 视频并使用 CamcorderProfile.QUALITY_CIF (int = 3) 时,我在 Sony Xperia Z3 (android 6.0.1)
中遇到错误
MediaProfiles: The given camcorder profile camera 0 quality 3 is not found
System.err: java.lang.RuntimeException: Error retrieving camcorder profile params
System.err: at android.media.CamcorderProfile.native_get_camcorder_profile(Native Method)
System.err: at android.media.CamcorderProfile.get(CamcorderProfile.java:471)
System.err: at android.media.CamcorderProfile.get(CamcorderProfile.java:402)
<...>
AOSP测试套件还没有测试SDK相机画质常量吗?我可以在生产中使用哪些常量并期望所有手机(至少从 5.0 开始)都支持它?
But when I trying to get 360p video, and using CamcorderProfile.QUALITY_CIF (int = 3), I get en error in Sony Xperia Z3 (android 6.0.1)
如果您调用hasProfile()
,查看配置文件是否受支持,它返回true
,但您仍然遇到此崩溃,则说明设备固件存在错误。
如果您没有调用 hasProfile()
,或者您忽略了它的结果,那么您的应用程序中存在错误。
What constants can I use in production and expect all phones (at least from 5.0) support it?
我不认为这是正式记录的。我 认为 QUALITY_LOW
和 QUALITY_HIGH
应该始终存在,尽管它们的输出可能有效也可能无效。
我有一个代码示例:
mediaRecorder = new MediaRecorder();
mediaRecorder.setPreviewDisplay(surfaceHolder.getSurface());
mediaRecorder.setCamera(camera);
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_480P));
这似乎工作正常,CamcorderProfile.QUALITY_LOW
但是当我尝试获取 360p 视频并使用 CamcorderProfile.QUALITY_CIF (int = 3) 时,我在 Sony Xperia Z3 (android 6.0.1)
中遇到错误MediaProfiles: The given camcorder profile camera 0 quality 3 is not found
System.err: java.lang.RuntimeException: Error retrieving camcorder profile params
System.err: at android.media.CamcorderProfile.native_get_camcorder_profile(Native Method)
System.err: at android.media.CamcorderProfile.get(CamcorderProfile.java:471)
System.err: at android.media.CamcorderProfile.get(CamcorderProfile.java:402)
<...>
AOSP测试套件还没有测试SDK相机画质常量吗?我可以在生产中使用哪些常量并期望所有手机(至少从 5.0 开始)都支持它?
But when I trying to get 360p video, and using CamcorderProfile.QUALITY_CIF (int = 3), I get en error in Sony Xperia Z3 (android 6.0.1)
如果您调用hasProfile()
,查看配置文件是否受支持,它返回true
,但您仍然遇到此崩溃,则说明设备固件存在错误。
如果您没有调用 hasProfile()
,或者您忽略了它的结果,那么您的应用程序中存在错误。
What constants can I use in production and expect all phones (at least from 5.0) support it?
我不认为这是正式记录的。我 认为 QUALITY_LOW
和 QUALITY_HIGH
应该始终存在,尽管它们的输出可能有效也可能无效。