FileDescriptorOutputOptions.Builder

@RequiresApi(value = 21)
class FileDescriptorOutputOptions.Builder


The builder of the FileDescriptorOutputOptions object.

Summary

Public constructors

Builder(fileDescriptor: ParcelFileDescriptor)

Creates a builder of the FileDescriptorOutputOptions with a file descriptor.

Public functions

FileDescriptorOutputOptions

Builds the FileDescriptorOutputOptions instance.

B
setDurationLimitMillis(durationLimitMillis: @IntRange(from = 0) Long)

Sets the limit for the video duration in milliseconds.

B
setFileSizeLimit(fileSizeLimitBytes: @IntRange(from = 0) Long)

Sets the limit for the file length in bytes.

B
setLocation(location: Location?)

Sets a Location object representing a geographic location where the video was recorded.

Public constructors

Builder

Added in 1.1.0
Builder(fileDescriptor: ParcelFileDescriptor)

Creates a builder of the FileDescriptorOutputOptions with a file descriptor.

Parameters
fileDescriptor: ParcelFileDescriptor

the file descriptor to use as the output destination.

Public functions

build

Added in 1.1.0
fun build(): FileDescriptorOutputOptions

Builds the FileDescriptorOutputOptions instance.

setDurationLimitMillis

Added in 1.3.0
fun setDurationLimitMillis(durationLimitMillis: @IntRange(from = 0) Long): B

Sets the limit for the video duration in milliseconds.

When used to generate recording with Recorder, if the specified duration limit is reached while the recording is being recorded, the recording will be finalized with ERROR_DURATION_LIMIT_REACHED.

If not set or set with zero, the duration will be unlimited. If set with a negative value, an IllegalArgumentException will be thrown.

Parameters
durationLimitMillis: @IntRange(from = 0) Long

the video duration limit in milliseconds.

Returns
B

this Builder.

Throws
java.lang.IllegalArgumentException

if the specified duration limit is negative.

setFileSizeLimit

Added in 1.1.0
fun setFileSizeLimit(fileSizeLimitBytes: @IntRange(from = 0) Long): B

Sets the limit for the file length in bytes.

When used with Recorder to generate recording, if the specified file size limit is reached while the recording is being recorded, the recording will be finalized with ERROR_FILE_SIZE_LIMIT_REACHED.

If not set or set with zero, the file size will be unlimited. If set with a negative value, an IllegalArgumentException will be thrown.

Parameters
fileSizeLimitBytes: @IntRange(from = 0) Long

the file size limit in bytes.

Returns
B

this Builder.

Throws
java.lang.IllegalArgumentException

if the specified file size limit is negative.

setLocation

Added in 1.2.0
fun setLocation(location: Location?): B

Sets a Location object representing a geographic location where the video was recorded.

When use with Recorder, the geographic location is stored in udta box if the output format is MP4, and is ignored for other formats. The geographic location is stored according to ISO-6709 standard.

If null, no location information will be saved with the video. Default value is null.

Throws
java.lang.IllegalArgumentException

if the latitude of the location is not in the range [-90, 90] or the longitude of the location is not in the range [-180, 180].