-
- All Implemented Interfaces:
-
com.otaliastudios.cameraview.preview.RendererFrameCallback,com.otaliastudios.cameraview.video.encoding.MediaEncoderEngine.Listener
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2) public class SnapshotVideoRecorder extends VideoRecorder implements RendererFrameCallback, MediaEncoderEngine.Listener
A VideoRecorder that uses android.media.MediaCodec APIs.
-
-
Constructor Summary
Constructors Constructor Description SnapshotVideoRecorder(CameraEngine engine, RendererCameraPreview preview, Overlay overlay)
-
Method Summary
Modifier and Type Method Description voidonRendererTextureCreated(int textureId)Called on the renderer thread, hopefully only once, to notify thatthe texture was created (or to inform a new callback of the old texture). voidonRendererFilterChanged(@NonNull() Filter filter)Called when the renderer filter changes. voidonRendererFrame(@NonNull() SurfaceTexture surfaceTexture, int rotation, float scaleX, float scaleY)Called on the renderer thread after each frame was drawn.You are not supposed to hold for too long onto this thread, becausewell, it is the rendering thread. voidonEncodingStart()Called when encoding started. voidonEncodingStop()Called when encoding stopped. voidonEncodingEnd(int stopReason, @Nullable() Exception e)Called when encoding ended for some reason.If there's an exception, it failed. -
Methods inherited from class com.otaliastudios.cameraview.video.VideoRecorder
isRecording, start, stop -
Methods inherited from class com.otaliastudios.cameraview.preview.RendererFrameCallback
onRendererFrame -
Methods inherited from class com.otaliastudios.cameraview.video.encoding.MediaEncoderEngine.Listener
onEncodingEnd -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
SnapshotVideoRecorder
SnapshotVideoRecorder(CameraEngine engine, RendererCameraPreview preview, Overlay overlay)
-
-
Method Detail
-
onRendererTextureCreated
void onRendererTextureCreated(int textureId)
Called on the renderer thread, hopefully only once, to notify thatthe texture was created (or to inform a new callback of the old texture).
- Parameters:
textureId- the GL texture linked to the image stream
-
onRendererFilterChanged
void onRendererFilterChanged(@NonNull() Filter filter)
Called when the renderer filter changes. This is guaranteed to be called at least oncebefore the first onRendererFrame.
- Parameters:
filter- the new filter
-
onRendererFrame
void onRendererFrame(@NonNull() SurfaceTexture surfaceTexture, int rotation, float scaleX, float scaleY)
Called on the renderer thread after each frame was drawn.You are not supposed to hold for too long onto this thread, becausewell, it is the rendering thread.
- Parameters:
surfaceTexture- the texture to get transformationrotation- the rotation (to reach REF_VIEW)scaleX- the scaleX (in REF_VIEW) valuescaleY- the scaleY (in REF_VIEW) value
-
onEncodingStart
void onEncodingStart()
Called when encoding started.
-
onEncodingStop
void onEncodingStop()
Called when encoding stopped. At this point the muxer or the encoders might still beprocessing data, but we have stopped receiving input (recording video and audio frames).Actually, we will stop very soon.The onEncodingEnd callback will soon be calledwith the results.
-
onEncodingEnd
void onEncodingEnd(int stopReason, @Nullable() Exception e)
Called when encoding ended for some reason.If there's an exception, it failed.
- Parameters:
e- the error, if present
-
-
-
-