Android getSupportedVideoSizes始终返回null

编程入门 行业动态 更新时间:2024-10-24 21:33:42
本文介绍了Android getSupportedVideoSizes始终返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在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

本文发布于:2023-11-14 19:14:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588302.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Android   getSupportedVideoSizes   null

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!