SurfaceHolder.setType是德precated ......但要求?SurfaceHolder、setType、precated

2023-09-05 09:59:30 作者:哎呦我去!

无效android.view.SurfaceHolder.setType(整型)

void android.view.SurfaceHolder.setType(int type)

公共抽象无效的setType(整型)自:API级别1

public abstract void setType (int type) Since: API Level 1

此方法去precated。此被忽略,此值被设置   在需要时自动。

This method is deprecated. this is ignored, this value is set automatically when needed.

设定表面的类型。

http://developer.android.com/reference/android/view/SurfaceHolder.html

它说,它会自动设置,但是,没有它我不能播放视频。发生了什么?有东西取代它?我有一个时间让视频在Android上正常播放。

It says it's set automatically but, without it my video doesn't play. What's going on here? Is there something that replaces it? I'm having a time getting video to play correctly on Android.

推荐答案

诀窍是知道什么时候的是pcated德$ P $,这是一种很难确定从我的经验的。文档始终是最新的可用最新的API,但是你可能没有最新的API上运行这个程序,如果我不得不猜测。所以,你还是要使用此方法(通常与PUSH_BUFFERS),使其工作在旧的平台。

The trick is in knowing when it was deprecated, which is kind of hard to determine from my experience. The documentation is always current for the latest API available, but you are probably not running this app on the latest API, if I had to guess. So you still have to use this method (typically with PUSH_BUFFERS) to make it work on older platforms.

编辑:这是pcated中的Andr​​oid 3.0,该文档反映,现在去$ P $ 因此,我们可以使用它像以下内容:

it was deprecated in Android 3.0, which the docs now reflect. So we can use it like following:

if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
    getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);