Android的getSupportedVideoSizes传真返回null [英] Android getSupportedVideoSizes allways returns null

查看:2393
本文介绍了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 查询:

In testing, the following devices return null when getSupportedVideoSizes is queried:


  • 的Galaxy Nexus(Android 4.2版)

  • 的HTC One迷你(是Android 4.4.2)

  • HTCEVOV4G(Android版4.0.3)

推荐答案

<一个href=\"http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getSupportedVideoSizes()\"相对=nofollow>为 Camera.getSupportedVideoSizes的文档() 其内容,

返回结果
  大小对象的列表,如果相机有单独的preVIEW和视频输出;否则,返回null。

Returns
a list of Size object if camera has separate preview and video output; otherwise, null is returned.

目前尚不完全清楚。然而,这意味着,如果 Camera.getSupportedVideoSizes()返回null,然后将相机支持preVIEW尺寸和视频尺寸是相同的;在这种情况下,要获得支持的视频尺寸列表中,使用 Camera.getSupported previewSizes()

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().

样code:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆