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
Modifier and TypeClassDescriptionstatic interface
-
Field Summary
Fields inherited from class com.banuba.sdk.player.VerifyCloseable
mIsClosed, mTag
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close an instance and free resourcesprotected void
frameAvailable
(long frameTimeNanos) Captures the next frame and writes it to a fileGet current state of recordingprotected WindowSurface
Returns the surface for drawing the frameprotected void
initializeMuxerAndSurface
(EglCore eglCore, android.util.Size frameSize) Must be called after calling startRecording(...) method and before frameAvailable(...).void
Check state and pause recordingvoid
recordAudioFromMicrophone
(boolean recordAudio) Capture audio from microphonevoid
Check state and resume recordingprotected void
Set a callback to change the state of a recordvoid
startRecording
(File outputFile) Start recording to video filevoid
startRecording
(File outputFile, IAudioDataProvider audioDataProvider) Start recording to video filevoid
Stop recording.void
Stops 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:
startRecording
in interfaceIVideoRecorder
- Parameters:
outputFile
- the output filename
-
startRecording
Start recording to video file- Specified by:
startRecording
in interfaceIVideoRecorder
- Parameters:
outputFile
- the output filenameaudioDataProvider
- callback with audio data
-
pauseRecording
@CallSuper public void pauseRecording()Check state and pause recording- Specified by:
pauseRecording
in interfaceIVideoRecorder
-
resumeRecording
@CallSuper public void resumeRecording()Check state and resume recording- Specified by:
resumeRecording
in 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:
stopRecording
in interfaceIVideoRecorder
-
stopRecordingAndWaitForFinish
@CallSuper public void stopRecordingAndWaitForFinish()Stops recording if recording was started and waits for the end of the video writing.- Specified by:
stopRecordingAndWaitForFinish
in interfaceIVideoRecorder
- See Also:
-
getRecordingState
Get current state of recording- Specified by:
getRecordingState
in interfaceIVideoRecorder
- Returns:
- recording state
-
close
public void close()Close an instance and free resources- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in 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
-