void android.view.SurfaceHolder.setType(int type)
public abstract void setType (int type) Since: API Level 1
This method is deprecated. this is ignored, this value is set automatically when needed.
Sets the surface's type.
http://developer.android.com/reference/android/view/SurfaceHolder.html
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.
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.
EDIT: 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);
来源:https://stackoverflow.com/questions/9439186/surfaceholder-settype-is-deprecated-but-required