Package com.banuba.sdk.video
Class VideoFileRecorder
java.lang.Object
com.banuba.sdk.player.VerifyCloseable
com.banuba.sdk.video.VideoFileRecorder
- All Implemented Interfaces:
IVideoRecorder,Closeable,AutoCloseable
- Direct Known Subclasses:
VideoOutput
Render video to the offscreen surface and save it to a video file
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface -
Field Summary
Fields inherited from class com.banuba.sdk.player.VerifyCloseable
mIsClosed, mTag -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close an instance and free resourcesprotected voidframeAvailable(long frameTimeNanos) Captures the next frame and writes it to a fileGet current state of recordingprotected WindowSurfaceReturns the surface for drawing the frameprotected voidinitializeMuxerAndSurface(EglCore eglCore, android.util.Size frameSize) Must be called after calling startRecording(...) method and before frameAvailable(...).voidCheck state and pause recordingvoidrecordAudioFromMicrophone(boolean recordAudio) Capture audio from microphonevoidCheck state and resume recordingprotected voidSet a callback to change the state of a recordvoidstartRecording(File outputFile) Start recording to video filevoidstartRecording(File outputFile, IAudioDataProvider audioDataProvider) Start recording to video filevoidStop recording.voidStops recording if recording was started and waits for the end of the video writing.Methods inherited from class com.banuba.sdk.player.VerifyCloseable
finalize
-
Constructor Details
-
VideoFileRecorder
public VideoFileRecorder() -
VideoFileRecorder
-
-
Method Details
-
recordAudioFromMicrophone
public void recordAudioFromMicrophone(boolean recordAudio) Capture audio from microphone- Parameters:
recordAudio- do the capture flag
-
setRecordingStateChangedListener
protected void setRecordingStateChangedListener(VideoFileRecorder.IRecordingStateChangedListener listener) Set a callback to change the state of a record- Parameters:
listener- callback
-
startRecording
Start recording to video file- Specified by:
startRecordingin interfaceIVideoRecorder- Parameters:
outputFile- the output filename
-
startRecording
Start recording to video file- Specified by:
startRecordingin interfaceIVideoRecorder- Parameters:
outputFile- the output filenameaudioDataProvider- callback with audio data
-
pauseRecording
@CallSuper public void pauseRecording()Check state and pause recording- Specified by:
pauseRecordingin interfaceIVideoRecorder
-
resumeRecording
@CallSuper public void resumeRecording()Check state and resume recording- Specified by:
resumeRecordingin interfaceIVideoRecorder
-
stopRecording
@CallSuper public void stopRecording()Stop recording. After call this method the file will be automatically saved to the path specified at the start of recording. File will be saved in another thread. To wait for a video file to be written, use thestopRecordingAndWaitForFinish()method.- Specified by:
stopRecordingin interfaceIVideoRecorder
-
stopRecordingAndWaitForFinish
@CallSuper public void stopRecordingAndWaitForFinish()Stops recording if recording was started and waits for the end of the video writing.- Specified by:
stopRecordingAndWaitForFinishin interfaceIVideoRecorder- See Also:
-
getRecordingState
Get current state of recording- Specified by:
getRecordingStatein interfaceIVideoRecorder- Returns:
- recording state
-
close
public void close()Close an instance and free resources- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classVerifyCloseable
-
initializeMuxerAndSurface
Must be called after calling startRecording(...) method and before frameAvailable(...). Initializes writing to a file.- Parameters:
eglCore- opengl contextframeSize- output video file resolution
-
getRenderingSurface
Returns the surface for drawing the frame -
frameAvailable
protected void frameAvailable(long frameTimeNanos) Captures the next frame and writes it to a file- Parameters:
frameTimeNanos- frame time in nanoseconds
-