Class MediaRecorderBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaudioChannels(int numChannels) Set the number of audio channels in the media recorder.bitRate(int bitRate) Sets the bit rate for the recorder.build()Builds the MediaRecorder with the given settings.intGets the current audio channels settings.intGets the current bit rate.Gets the current mimetype.getPath()Gets the current output path.intGets the current sampling rate.booleanTrue if the media recorder should redirect output to an audio buffer instead of a file.Sets the mimetype to use for encoding the audio file.Sets the output path where the audio recording should be saved.redirectToAudioBuffer(boolean redirect) Set this flag to true to redirect the microphone input to an audio buffer.samplingRate(int samplingRate) Sets the sampling rate for the recorder.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
Constructor Details
-
MediaRecorderBuilder
public MediaRecorderBuilder()
-
-
Method Details
-
audioChannels
Set the number of audio channels in the media recorder. Default 1.
Parameters
numChannels: The number of audio channels in the media recorder.
Returns
Self for chaining
-
bitRate
Sets the bit rate for the recorder. Default 64000.
Parameters
bitRate: The bit rate for the recorder.
Returns
Self for chaining.
-
samplingRate
Sets the sampling rate for the recorder. Default 44100
Parameters
samplingRate: The sample rate for the recorder.
Returns
Self for chaining.
-
mimeType
Sets the mimetype to use for encoding the audio file.
Parameters
mimeType: The mimetype to use for encoding the audio file.
Returns
Self for chaining.
See also
- MediaManager#getAvailableRecordingMimeTypes()
-
path
Sets the output path where the audio recording should be saved.
Parameters
path: @param path The output path where the recording should be saved as acom.codename1.io.FileSystemStoragepath
Returns
Self for chaining.
-
redirectToAudioBuffer
Set this flag to true to redirect the microphone input to an audio buffer. This is handy if you just want to capture the raw PCM data from the microphone.
Parameters
redirect: @param redirect True to redirect output to an audio buffer. The#path(java.lang.String)parameter would then be used as the path to the audio buffer instead of the output file.
Returns
Self for chaining.
-
build
Builds the MediaRecorder with the given settings.
Throws
-
IOException -
IllegalStateException: If#path(java.lang.String)is not set.
- Throws:
IOException
-
-
getAudioChannels
public int getAudioChannels()Gets the current audio channels settings.
Returns
the audioChannels
-
getBitRate
public int getBitRate()Gets the current bit rate.
Returns
the bitRate
-
getSamplingRate
public int getSamplingRate()Gets the current sampling rate.
Returns
the samplingRate
-
getMimeType
Gets the current mimetype.
Returns
the mimeType
-
getPath
Gets the current output path.
Returns
the path
-
isRedirectToAudioBuffer
public boolean isRedirectToAudioBuffer()True if the media recorder should redirect output to an audio buffer instead of a file.
-