DefaultMediaCodecAdapterFactory


@UnstableApi
class DefaultMediaCodecAdapterFactory : MediaCodecAdapter.Factory


The default MediaCodecAdapter.Factory.

By default, this factory createsAsynchronousMediaCodecAdapter instances on devices with API level >= 31 (Android 12+). For devices with older API versions, the default behavior is to create SynchronousMediaCodecAdapter instances. The factory offers APIs to force the creation of AsynchronousMediaCodecAdapter (applicable for devices with API >= 23) or SynchronousMediaCodecAdapter instances.

Summary

Public constructors

This function is deprecated.

Use DefaultMediaCodecAdapterFactory instead.

Creates the default media codec adapter factory.

Public functions

MediaCodecAdapter!

Creates a MediaCodecAdapter instance.

DefaultMediaCodecAdapterFactory!

Sets whether to enable CONFIGURE_FLAG_USE_CRYPTO_ASYNC on API 34 and above for AsynchronousMediaCodecAdapter instances.

DefaultMediaCodecAdapterFactory!

Forces the factory to always create SynchronousMediaCodecAdapter instances.

DefaultMediaCodecAdapterFactory!

Forces this factory to always create AsynchronousMediaCodecAdapter instances, provided the device API level is >= 23.

Inherited Constants

From androidx.media3.exoplayer.mediacodec.MediaCodecAdapter.Factory
const MediaCodecAdapter.Factory!

This property is deprecated.

Use getDefault instead.

Inherited functions

From androidx.media3.exoplayer.mediacodec.MediaCodecAdapter.Factory
java-static MediaCodecAdapter.Factory!
getDefault(context: Context!)

Returns the default factory that should be used in most cases.

Public constructors

DefaultMediaCodecAdapterFactory

DefaultMediaCodecAdapterFactory()

DefaultMediaCodecAdapterFactory

DefaultMediaCodecAdapterFactory(context: Context!)

Creates the default media codec adapter factory.

Parameters
context: Context!

A Context.

Public functions

createAdapter

fun createAdapter(configuration: MediaCodecAdapter.Configuration!): MediaCodecAdapter!

Creates a MediaCodecAdapter instance.

experimentalSetAsyncCryptoFlagEnabled

@CanIgnoreReturnValue
fun experimentalSetAsyncCryptoFlagEnabled(enableAsyncCryptoFlag: Boolean): DefaultMediaCodecAdapterFactory!

Sets whether to enable CONFIGURE_FLAG_USE_CRYPTO_ASYNC on API 34 and above for AsynchronousMediaCodecAdapter instances.

This method is experimental. Its default value may change, or it may be renamed or removed in a future release.

forceDisableAsynchronous

@CanIgnoreReturnValue
fun forceDisableAsynchronous(): DefaultMediaCodecAdapterFactory!

Forces the factory to always create SynchronousMediaCodecAdapter instances.

Returns
DefaultMediaCodecAdapterFactory!

This factory, for convenience.

forceEnableAsynchronous

@CanIgnoreReturnValue
fun forceEnableAsynchronous(): DefaultMediaCodecAdapterFactory!

Forces this factory to always create AsynchronousMediaCodecAdapter instances, provided the device API level is >= 23. For devices with API level <23, the factory will create SynchronousMediaCodecAdapters.

Returns
DefaultMediaCodecAdapterFactory!

This factory, for convenience.