public class SurfaceView
extends android.view.SurfaceView
implements java.lang.Runnable
MediaStream.setStreamingMethod(byte)
with MediaStream.MODE_MEDIACODEC_API_2
. setAspectRatioMode(int)
with
ASPECT_RATIO_PREVIEW
after creating your
SurfaceView
. Modifier and Type | Class and Description |
---|---|
class |
SurfaceView.ViewAspectRatioMeasurer
This class is a helper to measure views that require a specific aspect ratio.
|
Modifier and Type | Field and Description |
---|---|
static int |
ASPECT_RATIO_PREVIEW
The aspect ratio of the surface view will be equal
to the aspect ration of the camera preview.
|
static int |
ASPECT_RATIO_STRETCH
The surface view will fill completely fill its parent.
|
static java.lang.String |
TAG |
Constructor and Description |
---|
SurfaceView(Context context,
AttributeSet attrs) |
Modifier and Type | Method and Description |
---|---|
void |
addMediaCodecSurface(Surface surface) |
SurfaceTexture |
getSurfaceTexture() |
void |
onFrameAvailable(SurfaceTexture surfaceTexture) |
void |
removeMediaCodecSurface() |
void |
requestAspectRatio(double aspectRatio)
Requests a certain aspect ratio for the preview.
|
void |
run() |
void |
setAspectRatioMode(int mode) |
void |
startGLThread() |
void |
surfaceChanged(SurfaceHolder holder,
int format,
int width,
int height) |
void |
surfaceCreated(SurfaceHolder holder) |
void |
surfaceDestroyed(SurfaceHolder holder) |
public static final java.lang.String TAG
public static final int ASPECT_RATIO_PREVIEW
public static final int ASPECT_RATIO_STRETCH
public void setAspectRatioMode(int mode)
public SurfaceTexture getSurfaceTexture()
public void addMediaCodecSurface(Surface surface)
public void removeMediaCodecSurface()
public void startGLThread()
public void run()
run
in interface java.lang.Runnable
public void onFrameAvailable(SurfaceTexture surfaceTexture)
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
public void surfaceCreated(SurfaceHolder holder)
public void surfaceDestroyed(SurfaceHolder holder)
public void requestAspectRatio(double aspectRatio)
VideoStream
will do it when it's needed.