public abstract class

MediaSpec.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.camera.video.MediaSpec.Builder

Overview

The builder for MediaSpec.

Summary

Methods
public abstract MediaSpecbuild()

Build the MediaSpec from this builder.

public MediaSpec.BuilderconfigureAudio(Consumer<AudioSpec.Builder> configBlock)

Configures the AudioSpec of this media specification with the given block.

public MediaSpec.BuilderconfigureVideo(Consumer<VideoSpec.Builder> configBlock)

Configures the VideoSpec of this media specification with the given block.

public abstract MediaSpec.BuildersetAudioSpec(AudioSpec audioSpec)

Sets audio related configuration.

public abstract MediaSpec.BuildersetOutputFormat(int format)

Sets the video recording output format.

public abstract MediaSpec.BuildersetVideoSpec(VideoSpec videoSpec)

Sets video related configuration.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public abstract MediaSpec.Builder setAudioSpec(AudioSpec audioSpec)

Sets audio related configuration.

If not set, contains the default implementation of AudioSpec returned by AudioSpec.Builder.build().

The provided specification will override all audio related properties of this media specification. If only some properties need to be modified, use MediaSpec.Builder.configureAudio(Consumer).

To request disabling audio, this should be set to AudioSpec.NO_AUDIO.

public MediaSpec.Builder configureAudio(Consumer<AudioSpec.Builder> configBlock)

Configures the AudioSpec of this media specification with the given block.

This is a convenience method for in-line configuration of the AudioSpec contained in this media spec. The AudioSpec.Builder provided to configBlock is pre-populated with the current state of the internal audio spec.

Usage: MediaSpec.Builder mediaSpecBuilder = ...; MediaSpec mediaSpec = mediaSpecBuilder .configureAudio(audioSpecBuilder -> { audioSpecBuilder .setSource(...) .setSampleRate(...) }) .setOutputFormat(...) .build();

Parameters:

configBlock: A consumer which provides the AudioSpec.Builder which will configure the AudioSpec of this media specification.

public abstract MediaSpec.Builder setVideoSpec(VideoSpec videoSpec)

Sets video related configuration.

If not set, contains the default implementation of VideoSpec returned by VideoSpec.Builder.build().

The provided specification will override all video related properties of this media specification. If only some properties need to be modified, use MediaSpec.Builder.configureVideo(Consumer).

public MediaSpec.Builder configureVideo(Consumer<VideoSpec.Builder> configBlock)

Configures the VideoSpec of this media specification with the given block.

This is a convenience method for in-line configuration of the VideoSpec contained in this media spec. The VideoSpec.Builder provided to configBlock is pre-populated with the current state of the internal video spec.

Usage: MediaSpec.Builder mediaSpecBuilder = ...; MediaSpec mediaSpec = mediaSpecBuilder .configureVideo(videoSpecBuilder -> { videoSpecBuilder .setQualitySelector(...) .setBitrate(...) }) .setOutputFormat(...) .build();

Parameters:

configBlock: A consumer which provides the VideoSpec.Builder which will configure the VideoSpec of this media specification.

public abstract MediaSpec.Builder setOutputFormat(int format)

Sets the video recording output format.

If not set, the default is MediaSpec.OUTPUT_FORMAT_AUTO.

Parameters:

format: The requested video format. Possible values are MediaSpec.OUTPUT_FORMAT_AUTO, MediaSpec.OUTPUT_FORMAT_MPEG_4 or MediaSpec.OUTPUT_FORMAT_WEBM.

public abstract MediaSpec build()

Build the MediaSpec from this builder.