在Android上的MediaRecorder类上,我需要一些帮助.
I need some help with the MediaRecorder class on Android.
我尝试使用getSupportedVideoSizes来获取支持的视频尺寸列表,但它始终返回null.
I try to use getSupportedVideoSizes to get the list of supported video sizes, but it always returns null.
在测试中,查询getSupportedVideoSizes时,以下设备将返回null:
In testing, the following devices return null when getSupportedVideoSizes is queried:
- Galaxy Nexus(Android 4.2)
- HTC One Mini(Android 4.4.2)
- HTCEVOV4G(Android 4.0.3)
Camera.getSupportedVideoSizes() 的文档,其内容为
The documentation for Camera.getSupportedVideoSizes() which reads,
返回 如果摄像机具有单独的预览和视频输出,则列出Size对象;否则,将返回null.
Returns a list of Size object if camera has separate preview and video output; otherwise, null is returned.
尚不完全清楚.但是,这意味着如果Camera.getSupportedVideoSizes()返回null,则相机支持的预览尺寸和视频尺寸相同;反之,在这种情况下,要获取支持的视频尺寸列表,请使用Camera.getSupportedPreviewSizes().
is not entirely clear. However, it means that if Camera.getSupportedVideoSizes() returns null, then the camera's supported preview sizes and video sizes are the same; in this case, to get the list of supported video sizes, use Camera.getSupportedPreviewSizes().
示例代码:
public List<Size> getSupportedVideoSizes(Camera camera) { if (camera.getParameters().getSupportedVideoSizes() != null) { return camera.getParameters().getSupportedVideoSizes(); } else { // Video sizes may be null, which indicates that all the supported // preview sizes are supported for video recording. return camera.getParameters().getSupportedPreviewSizes(); } }更多推荐
Android getSupportedVideoSizes始终返回null
发布评论