Class DefaultRenderersFactory
- java.lang.Object
-
- com.google.android.exoplayer2.DefaultRenderersFactory
-
- All Implemented Interfaces:
RenderersFactory
@Deprecated public class DefaultRenderersFactory extends Object implements RenderersFactory
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.DefaultRenderersFactory
implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DefaultRenderersFactory.ExtensionRendererMode
Deprecated.Modes for using extension renderers.
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS
Deprecated.The default maximum duration for which a video renderer can attempt to seamlessly join an ongoing playback.static int
EXTENSION_RENDERER_MODE_OFF
Deprecated.Do not allow use of extension renderers.static int
EXTENSION_RENDERER_MODE_ON
Deprecated.Allow use of extension renderers.static int
EXTENSION_RENDERER_MODE_PREFER
Deprecated.Allow use of extension renderers.static int
MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY
Deprecated.The maximum number of frames that can be dropped between invocations ofVideoRendererEventListener.onDroppedFrames(int, long)
.
-
Constructor Summary
Constructors Constructor Description DefaultRenderersFactory(Context context)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
buildAudioRenderers(Context context, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, MediaCodecSelector mediaCodecSelector, boolean enableDecoderFallback, AudioSink audioSink, Handler eventHandler, AudioRendererEventListener eventListener, ArrayList<Renderer> out)
Deprecated.Builds audio renderers for use by the player.protected AudioSink
buildAudioSink(Context context, boolean enableFloatOutput, boolean enableAudioTrackPlaybackParams, boolean enableOffload)
Deprecated.Builds anAudioSink
to which the audio renderers will output.protected void
buildCameraMotionRenderers(Context context, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out)
Deprecated.Builds camera motion renderers for use by the player.protected void
buildMetadataRenderers(Context context, MetadataOutput output, Looper outputLooper, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out)
Deprecated.Builds metadata renderers for use by the player.protected void
buildMiscellaneousRenderers(Context context, Handler eventHandler, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out)
Deprecated.Builds any miscellaneous renderers used by the player.protected void
buildTextRenderers(Context context, TextOutput output, Looper outputLooper, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out)
Deprecated.Builds text renderers for use by the player.protected void
buildVideoRenderers(Context context, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, MediaCodecSelector mediaCodecSelector, boolean enableDecoderFallback, Handler eventHandler, VideoRendererEventListener eventListener, long allowedVideoJoiningTimeMs, ArrayList<Renderer> out)
Deprecated.Builds video renderers for use by the player.Renderer[]
createRenderers(Handler eventHandler, VideoRendererEventListener videoRendererEventListener, AudioRendererEventListener audioRendererEventListener, TextOutput textRendererOutput, MetadataOutput metadataRendererOutput)
Deprecated.DefaultRenderersFactory
experimentalSetSynchronizeCodecInteractionsWithQueueingEnabled(boolean enabled)
Deprecated.Enable synchronizing codec interactions with asynchronous buffer queueing.DefaultRenderersFactory
forceDisableMediaCodecAsynchronousQueueing()
Deprecated.DisablesMediaCodecRenderer
instances from operating theirMediaCodec
in asynchronous mode and perform asynchronous queueing.DefaultRenderersFactory
forceEnableMediaCodecAsynchronousQueueing()
Deprecated.EnablesMediaCodecRenderer
instances to operate theirMediaCodec
in asynchronous mode and perform asynchronous queueing.protected MediaCodecAdapter.Factory
getCodecAdapterFactory()
Deprecated.Returns theMediaCodecAdapter.Factory
that will be used when creatingMediaCodecRenderer
instances.DefaultRenderersFactory
setAllowedVideoJoiningTimeMs(long allowedVideoJoiningTimeMs)
Deprecated.Sets the maximum duration for which video renderers can attempt to seamlessly join an ongoing playback.DefaultRenderersFactory
setEnableAudioFloatOutput(boolean enableFloatOutput)
Deprecated.Sets whether floating point audio should be output when possible.DefaultRenderersFactory
setEnableAudioOffload(boolean enableOffload)
Deprecated.Sets whether audio should be played using the offload path.DefaultRenderersFactory
setEnableAudioTrackPlaybackParams(boolean enableAudioTrackPlaybackParams)
Deprecated.Sets whether to enable setting playback speed usingAudioTrack.setPlaybackParams(PlaybackParams)
, which is supported from API level 23, rather than using application-level audio speed adjustment.DefaultRenderersFactory
setEnableDecoderFallback(boolean enableDecoderFallback)
Deprecated.Sets whether to enable fallback to lower-priority decoders if decoder initialization fails.DefaultRenderersFactory
setExtensionRendererMode(@com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode)
Deprecated.Sets the extension renderer mode, which determines if and how available extension renderers are used.DefaultRenderersFactory
setMediaCodecSelector(MediaCodecSelector mediaCodecSelector)
Deprecated.Sets aMediaCodecSelector
for use byMediaCodec
based renderers.
-
-
-
Field Detail
-
DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS
public static final long DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS
Deprecated.The default maximum duration for which a video renderer can attempt to seamlessly join an ongoing playback.- See Also:
- Constant Field Values
-
EXTENSION_RENDERER_MODE_OFF
public static final int EXTENSION_RENDERER_MODE_OFF
Deprecated.Do not allow use of extension renderers.- See Also:
- Constant Field Values
-
EXTENSION_RENDERER_MODE_ON
public static final int EXTENSION_RENDERER_MODE_ON
Deprecated.Allow use of extension renderers. Extension renderers are indexed after core renderers of the same type. ATrackSelector
that prefers the first suitable renderer will therefore prefer to use a core renderer to an extension renderer in the case that both are able to play a given track.- See Also:
- Constant Field Values
-
EXTENSION_RENDERER_MODE_PREFER
public static final int EXTENSION_RENDERER_MODE_PREFER
Deprecated.Allow use of extension renderers. Extension renderers are indexed before core renderers of the same type. ATrackSelector
that prefers the first suitable renderer will therefore prefer to use an extension renderer to a core renderer in the case that both are able to play a given track.- See Also:
- Constant Field Values
-
MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY
public static final int MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY
Deprecated.The maximum number of frames that can be dropped between invocations ofVideoRendererEventListener.onDroppedFrames(int, long)
.- See Also:
- Constant Field Values
-
-
Method Detail
-
setExtensionRendererMode
@CanIgnoreReturnValue public DefaultRenderersFactory setExtensionRendererMode(@com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode)
Deprecated.Sets the extension renderer mode, which determines if and how available extension renderers are used. Note that extensions must be included in the application build for them to be considered available.The default value is
EXTENSION_RENDERER_MODE_OFF
.- Parameters:
extensionRendererMode
- The extension renderer mode.- Returns:
- This factory, for convenience.
-
forceEnableMediaCodecAsynchronousQueueing
@CanIgnoreReturnValue public DefaultRenderersFactory forceEnableMediaCodecAsynchronousQueueing()
Deprecated.EnablesMediaCodecRenderer
instances to operate theirMediaCodec
in asynchronous mode and perform asynchronous queueing.This feature can be enabled only on devices with API versions >= 23. For devices with older API versions, this method is a no-op.
- Returns:
- This factory, for convenience.
-
forceDisableMediaCodecAsynchronousQueueing
@CanIgnoreReturnValue public DefaultRenderersFactory forceDisableMediaCodecAsynchronousQueueing()
Deprecated.DisablesMediaCodecRenderer
instances from operating theirMediaCodec
in asynchronous mode and perform asynchronous queueing.MediaCodec
instances will be operated synchronous mode.- Returns:
- This factory, for convenience.
-
experimentalSetSynchronizeCodecInteractionsWithQueueingEnabled
@CanIgnoreReturnValue public DefaultRenderersFactory experimentalSetSynchronizeCodecInteractionsWithQueueingEnabled(boolean enabled)
Deprecated.Enable synchronizing codec interactions with asynchronous buffer queueing.This method is experimental, and will be renamed or removed in a future release.
- Parameters:
enabled
- Whether codec interactions will be synchronized with asynchronous buffer queueing.- Returns:
- This factory, for convenience.
-
setEnableDecoderFallback
@CanIgnoreReturnValue public DefaultRenderersFactory setEnableDecoderFallback(boolean enableDecoderFallback)
Deprecated.Sets whether to enable fallback to lower-priority decoders if decoder initialization fails. This may result in using a decoder that is less efficient or slower than the primary decoder.- Parameters:
enableDecoderFallback
- Whether to enable fallback to lower-priority decoders if decoder initialization fails.- Returns:
- This factory, for convenience.
-
setMediaCodecSelector
@CanIgnoreReturnValue public DefaultRenderersFactory setMediaCodecSelector(MediaCodecSelector mediaCodecSelector)
Deprecated.Sets aMediaCodecSelector
for use byMediaCodec
based renderers.The default value is
MediaCodecSelector.DEFAULT
.- Parameters:
mediaCodecSelector
- TheMediaCodecSelector
.- Returns:
- This factory, for convenience.
-
setEnableAudioFloatOutput
@CanIgnoreReturnValue public DefaultRenderersFactory setEnableAudioFloatOutput(boolean enableFloatOutput)
Deprecated.Sets whether floating point audio should be output when possible.Enabling floating point output disables audio processing, but may allow for higher quality audio output.
The default value is
false
.- Parameters:
enableFloatOutput
- Whether to enable use of floating point audio output, if available.- Returns:
- This factory, for convenience.
-
setEnableAudioOffload
@CanIgnoreReturnValue public DefaultRenderersFactory setEnableAudioOffload(boolean enableOffload)
Deprecated.Sets whether audio should be played using the offload path.Audio offload disables ExoPlayer audio processing, but significantly reduces the energy consumption of the playback when
offload scheduling
is enabled.Most Android devices can only support one offload
AudioTrack
at a time and can invalidate it at any time. Thus an app can never be guaranteed that it will be able to play in offload.The default value is
false
.- Parameters:
enableOffload
- Whether to enable use of audio offload for supported formats, if available.- Returns:
- This factory, for convenience.
-
setEnableAudioTrackPlaybackParams
@CanIgnoreReturnValue public DefaultRenderersFactory setEnableAudioTrackPlaybackParams(boolean enableAudioTrackPlaybackParams)
Deprecated.Sets whether to enable setting playback speed usingAudioTrack.setPlaybackParams(PlaybackParams)
, which is supported from API level 23, rather than using application-level audio speed adjustment. This setting has no effect on builds before API level 23 (application-level speed adjustment will be used in all cases).If enabled and supported, new playback speed settings will take effect more quickly because they are applied at the audio mixer, rather than at the point of writing data to the track.
When using this mode, the maximum supported playback speed is limited by the size of the audio track's buffer. If the requested speed is not supported the player's event listener will be notified twice on setting playback speed, once with the requested speed, then again with the old playback speed reflecting the fact that the requested speed was not supported.
- Parameters:
enableAudioTrackPlaybackParams
- Whether to enable setting playback speed usingAudioTrack.setPlaybackParams(PlaybackParams)
.- Returns:
- This factory, for convenience.
-
setAllowedVideoJoiningTimeMs
@CanIgnoreReturnValue public DefaultRenderersFactory setAllowedVideoJoiningTimeMs(long allowedVideoJoiningTimeMs)
Deprecated.Sets the maximum duration for which video renderers can attempt to seamlessly join an ongoing playback.The default value is
DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS
.- Parameters:
allowedVideoJoiningTimeMs
- The maximum duration for which video renderers can attempt to seamlessly join an ongoing playback, in milliseconds.- Returns:
- This factory, for convenience.
-
createRenderers
public Renderer[] createRenderers(Handler eventHandler, VideoRendererEventListener videoRendererEventListener, AudioRendererEventListener audioRendererEventListener, TextOutput textRendererOutput, MetadataOutput metadataRendererOutput)
Deprecated.Description copied from interface:RenderersFactory
- Specified by:
createRenderers
in interfaceRenderersFactory
- Parameters:
eventHandler
- A handler to use when invoking event listeners and outputs.videoRendererEventListener
- An event listener for video renderers.audioRendererEventListener
- An event listener for audio renderers.textRendererOutput
- An output for text renderers.metadataRendererOutput
- An output for metadata renderers.- Returns:
- The
instances
.
-
buildVideoRenderers
protected void buildVideoRenderers(Context context, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, MediaCodecSelector mediaCodecSelector, boolean enableDecoderFallback, Handler eventHandler, VideoRendererEventListener eventListener, long allowedVideoJoiningTimeMs, ArrayList<Renderer> out)
Deprecated.Builds video renderers for use by the player.- Parameters:
context
- TheContext
associated with the player.extensionRendererMode
- The extension renderer mode.mediaCodecSelector
- A decoder selector.enableDecoderFallback
- Whether to enable fallback to lower-priority decoders if decoder initialization fails. This may result in using a decoder that is slower/less efficient than the primary decoder.eventHandler
- A handler associated with the main thread's looper.eventListener
- An event listener.allowedVideoJoiningTimeMs
- The maximum duration for which video renderers can attempt to seamlessly join an ongoing playback, in milliseconds.out
- An array to which the built renderers should be appended.
-
buildAudioRenderers
protected void buildAudioRenderers(Context context, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, MediaCodecSelector mediaCodecSelector, boolean enableDecoderFallback, AudioSink audioSink, Handler eventHandler, AudioRendererEventListener eventListener, ArrayList<Renderer> out)
Deprecated.Builds audio renderers for use by the player.- Parameters:
context
- TheContext
associated with the player.extensionRendererMode
- The extension renderer mode.mediaCodecSelector
- A decoder selector.enableDecoderFallback
- Whether to enable fallback to lower-priority decoders if decoder initialization fails. This may result in using a decoder that is slower/less efficient than the primary decoder.audioSink
- A sink to which the renderers will output.eventHandler
- A handler to use when invoking event listeners and outputs.eventListener
- An event listener.out
- An array to which the built renderers should be appended.
-
buildTextRenderers
protected void buildTextRenderers(Context context, TextOutput output, Looper outputLooper, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out)
Deprecated.Builds text renderers for use by the player.- Parameters:
context
- TheContext
associated with the player.output
- An output for the renderers.outputLooper
- The looper associated with the thread on which the output should be called.extensionRendererMode
- The extension renderer mode.out
- An array to which the built renderers should be appended.
-
buildMetadataRenderers
protected void buildMetadataRenderers(Context context, MetadataOutput output, Looper outputLooper, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out)
Deprecated.Builds metadata renderers for use by the player.- Parameters:
context
- TheContext
associated with the player.output
- An output for the renderers.outputLooper
- The looper associated with the thread on which the output should be called.extensionRendererMode
- The extension renderer mode.out
- An array to which the built renderers should be appended.
-
buildCameraMotionRenderers
protected void buildCameraMotionRenderers(Context context, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out)
Deprecated.Builds camera motion renderers for use by the player.- Parameters:
context
- TheContext
associated with the player.extensionRendererMode
- The extension renderer mode.out
- An array to which the built renderers should be appended.
-
buildMiscellaneousRenderers
protected void buildMiscellaneousRenderers(Context context, Handler eventHandler, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out)
Deprecated.Builds any miscellaneous renderers used by the player.- Parameters:
context
- TheContext
associated with the player.eventHandler
- A handler to use when invoking event listeners and outputs.extensionRendererMode
- The extension renderer mode.out
- An array to which the built renderers should be appended.
-
buildAudioSink
@Nullable protected AudioSink buildAudioSink(Context context, boolean enableFloatOutput, boolean enableAudioTrackPlaybackParams, boolean enableOffload)
Deprecated.Builds anAudioSink
to which the audio renderers will output.- Parameters:
context
- TheContext
associated with the player.enableFloatOutput
- Whether to enable use of floating point audio output, if available.enableAudioTrackPlaybackParams
- Whether to enable setting playback speed usingAudioTrack.setPlaybackParams(PlaybackParams)
, if supported.enableOffload
- Whether to enable use of audio offload for supported formats, if available.- Returns:
- The
AudioSink
to which the audio renderers will output. May benull
if no audio renderers are required. Ifnull
is returned thenbuildAudioRenderers(android.content.Context, @com.google.android.exoplayer2.DefaultRenderersFactory.ExtensionRendererMode int, com.google.android.exoplayer2.mediacodec.MediaCodecSelector, boolean, com.google.android.exoplayer2.audio.AudioSink, android.os.Handler, com.google.android.exoplayer2.audio.AudioRendererEventListener, java.util.ArrayList<com.google.android.exoplayer2.Renderer>)
will not be called.
-
getCodecAdapterFactory
protected MediaCodecAdapter.Factory getCodecAdapterFactory()
Deprecated.Returns theMediaCodecAdapter.Factory
that will be used when creatingMediaCodecRenderer
instances.
-
-