Most visited

Recently visited

ViroMediaRecorder

public class ViroMediaRecorder
extends Object

java.lang.Object
   ↳ com.viro.core.ViroMediaRecorder


ViroMediaRecorder enables you to take a screenshot or record a video of the scene rendered in your ViroView.

Summary

Nested classes

enum ViroMediaRecorder.Error

Enum indicating what error (if any) was encountered during a recording operation. 

interface ViroMediaRecorder.RecordingErrorListener

Listener for responding to errors when starting a recording, and for responding to errors during a recording. 

interface ViroMediaRecorder.ScreenshotFinishListener

Listener for responding to screenshot capture success and errors. 

interface ViroMediaRecorder.VideoRecordingFinishListener

Listener for responding to video recording success and errors. 

Public methods

void configureAudioInput(int encodingBitRate, int samplingBitRate, int encoder)

Reconfigures the audio settings of the underlying Android MediaRecorder used by the ViroMediaRecorder.

void startRecordingAsync(String fileName, boolean saveToCameraRoll, ViroMediaRecorder.RecordingErrorListener errorListener)

Schedules a screen recording to start on the next rendered frame.

void stopRecordingAsync(ViroMediaRecorder.VideoRecordingFinishListener finishListener)

Schedules the conclusion of the current video recording, if any.

void takeScreenShotAsync(ViroMediaRecorder.ScreenshotFinishListener finishListener)

Schedules a screenshot to be taken and saved on the next rendered frame.

void takeScreenShotAsync(String fileName, boolean saveToCameraRoll, ViroMediaRecorder.ScreenshotFinishListener finishListener)

Schedules a screenshot to be taken and saved on the next rendered frame.

Public methods

configureAudioInput

void configureAudioInput (int encodingBitRate, 
                int samplingBitRate, 
                int encoder)

Reconfigures the audio settings of the underlying Android MediaRecorder used by the ViroMediaRecorder. This must be called before any recording for it to take effect.

Parameters
encodingBitRate int: Sets the audio encoding bit rate for recording.

samplingBitRate int: Sets the audio sampling rate for recording. The sampling rate is ultimately determined by the format of the audio recording and capabilities of the platform.

encoder int: Sets the audio encoder to be used for recording.

See also:

startRecordingAsync

void startRecordingAsync (String fileName, 
                boolean saveToCameraRoll, 
                ViroMediaRecorder.RecordingErrorListener errorListener)

Schedules a screen recording to start on the next rendered frame. The recording will continue until stopRecordingAsync(VideoRecordingFinishListener) is invoked. When finished, the recording will be saved to the given file. The file will be stored in the device's photos if saveToCameraRoll is true; otherwise it is stored in getFilesDir().

Parameters
fileName String: The name of the file that will store the finished recording.

saveToCameraRoll boolean: True to save the recording to the camera roll. False to save the file in getFilesDir().

errorListener ViroMediaRecorder.RecordingErrorListener: Listener that is invoked if the recording operation encounters an error.

stopRecordingAsync

void stopRecordingAsync (ViroMediaRecorder.VideoRecordingFinishListener finishListener)

Schedules the conclusion of the current video recording, if any. The success or failure of this request are notified through the provided ViroMediaRecorder.VideoRecordingFinishListener.

Parameters
finishListener ViroMediaRecorder.VideoRecordingFinishListener: Callback interface that is invoked on success or failure.

takeScreenShotAsync

void takeScreenShotAsync (ViroMediaRecorder.ScreenshotFinishListener finishListener)

Schedules a screenshot to be taken and saved on the next rendered frame. When finished, a bitmap representing the taken screenshot will be provided in the ScreenshotFinishListener callback.

Parameters
finishListener ViroMediaRecorder.ScreenshotFinishListener: Callback interface that is invoked on success or failure.

takeScreenShotAsync

void takeScreenShotAsync (String fileName, 
                boolean saveToCameraRoll, 
                ViroMediaRecorder.ScreenshotFinishListener finishListener)

Schedules a screenshot to be taken and saved on the next rendered frame. When finished, the screenshot will be saved to the given file. The file will be stored in the device's photos if saveToCameraRoll is true; otherwise it is stored in getFilesDir().

Parameters
fileName String: The name of the file that will store the screenshot.

saveToCameraRoll boolean: True to save the screenshot to the camera roll. False to save the file in getFilesDir().

finishListener ViroMediaRecorder.ScreenshotFinishListener: Callback interface that is invoked on success or failure.

Hooray!