Back to Exoplayer

MetadataRenderer (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/metadata/MetadataRenderer.html

latest18.7 KB
Original Source

Package com.google.android.exoplayer2.metadata

Class MetadataRenderer


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classMetadataRendererextends[BaseRenderer](../BaseRenderer.html "class in com.google.android.exoplayer2")implements[Handler.Callback](https://developer.android.com/reference/android/os/Handler.Callback.html "class or interface in android.os")

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.

A renderer for metadata.

The renderer can be configured to render metadata as soon as they are available using MetadataRenderer(MetadataOutput, Looper, MetadataDecoderFactory, boolean).

Nested Class Summary

- 

Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Renderer

Renderer.MessageType, Renderer.State, Renderer.WakeupListener

- 

Nested classes/interfaces inherited from interface com.google.android.exoplayer2.RendererCapabilities

RendererCapabilities.AdaptiveSupport, RendererCapabilities.Capabilities, RendererCapabilities.DecoderSupport, RendererCapabilities.FormatSupport, RendererCapabilities.HardwareAccelerationSupport, RendererCapabilities.Listener, RendererCapabilities.TunnelingSupport

Field Summary

- 

Fields inherited from interface com.google.android.exoplayer2.Renderer

MSG_CUSTOM_BASE, MSG_SET_AUDIO_ATTRIBUTES, MSG_SET_AUDIO_SESSION_ID, MSG_SET_AUX_EFFECT_INFO, MSG_SET_CAMERA_MOTION_LISTENER, MSG_SET_CHANGE_FRAME_RATE_STRATEGY, MSG_SET_PREFERRED_AUDIO_DEVICE, MSG_SET_SCALING_MODE, MSG_SET_SKIP_SILENCE_ENABLED, MSG_SET_VIDEO_EFFECTS, MSG_SET_VIDEO_FRAME_METADATA_LISTENER, MSG_SET_VIDEO_OUTPUT, MSG_SET_VIDEO_OUTPUT_RESOLUTION, MSG_SET_VOLUME, MSG_SET_WAKEUP_LISTENER, STATE_DISABLED, STATE_ENABLED, STATE_STARTED

- 

Fields inherited from interface com.google.android.exoplayer2.RendererCapabilities

ADAPTIVE_NOT_SEAMLESS, ADAPTIVE_NOT_SUPPORTED, ADAPTIVE_SEAMLESS, ADAPTIVE_SUPPORT_MASK, DECODER_SUPPORT_FALLBACK, DECODER_SUPPORT_FALLBACK_MIMETYPE, DECODER_SUPPORT_PRIMARY, FORMAT_EXCEEDS_CAPABILITIES, FORMAT_HANDLED, FORMAT_SUPPORT_MASK, FORMAT_UNSUPPORTED_DRM, FORMAT_UNSUPPORTED_SUBTYPE, FORMAT_UNSUPPORTED_TYPE, HARDWARE_ACCELERATION_NOT_SUPPORTED, HARDWARE_ACCELERATION_SUPPORT_MASK, HARDWARE_ACCELERATION_SUPPORTED, MODE_SUPPORT_MASK, TUNNELING_NOT_SUPPORTED, TUNNELING_SUPPORT_MASK, TUNNELING_SUPPORTED

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | MetadataRenderer​(MetadataOutput output, Looper outputLooper) | Deprecated.

Creates an instance that uses MetadataDecoderFactory.DEFAULT to create MetadataDecoder instances. | | MetadataRenderer​(MetadataOutput output, Looper outputLooper, MetadataDecoderFactory decoderFactory) | Deprecated.

Creates an instance. | | MetadataRenderer​(MetadataOutput output, Looper outputLooper, MetadataDecoderFactory decoderFactory, boolean outputMetadataEarly) | Deprecated.

Creates an instance. |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | String | getName() | Deprecated.

Returns the name of this renderer, for logging and debugging purposes. | | boolean | handleMessage​(Message msg) | Deprecated. | | boolean | isEnded() | Deprecated.

Whether the renderer is ready for the ExoPlayer instance to transition to Player.STATE_ENDED. | | boolean | isReady() | Deprecated.

Whether the renderer is able to immediately render media from the current position. | | protected void | onDisabled() | Deprecated.

Called when the renderer is disabled. | | protected void | onPositionReset​(long positionUs, boolean joining) | Deprecated.

Called when the position is reset. | | protected void | onStreamChanged​(Format[] formats, long startPositionUs, long offsetUs) | Deprecated.

Called when the renderer's stream has changed. | | void | render​(long positionUs, long elapsedRealtimeUs) | Deprecated.

Incrementally renders the SampleStream. | | @com.google.android.exoplayer2.RendererCapabilities.Capabilities int | supportsFormat​(Format format) | Deprecated.

Returns the extent to which the Renderer supports a given format. |

- 

Methods inherited from class com.google.android.exoplayer2.BaseRenderer

clearListener, createRendererException, createRendererException, disable, enable, getCapabilities, getConfiguration, getFormatHolder, getIndex, getLastResetPositionUs, getMediaClock, getPlayerId, getReadingPositionUs, getState, getStream, getStreamFormats, getTrackType, handleMessage, hasReadStreamToEnd, init, isCurrentStreamFinal, isSourceReady, maybeThrowStreamError, onEnabled, onRelease, onRendererCapabilitiesChanged, onReset, onStarted, onStopped, readSource, release, replaceStream, reset, resetPosition, setCurrentStreamFinal, setListener, skipSource, start, stop, supportsMixedMimeTypeAdaptation

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

- 

Methods inherited from interface com.google.android.exoplayer2.Renderer

setPlaybackSpeed

Constructor Detail

- 

MetadataRenderer

public MetadataRenderer​([MetadataOutput](MetadataOutput.html "interface in com.google.android.exoplayer2.metadata")output,
                        @Nullable[Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")outputLooper)

Deprecated.

Creates an instance that uses MetadataDecoderFactory.DEFAULT to create MetadataDecoder instances. Parameters:output - The output.outputLooper - The looper associated with the thread on which the output should be called. If the output makes use of standard Android UI components, then this should normally be the looper associated with the application's main thread, which can be obtained using ContextWrapper.getMainLooper(). Null may be passed if the output should be called directly on the player's internal rendering thread.

- 

MetadataRenderer

public MetadataRenderer​([MetadataOutput](MetadataOutput.html "interface in com.google.android.exoplayer2.metadata")output,
                        @Nullable[Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")outputLooper,[MetadataDecoderFactory](MetadataDecoderFactory.html "interface in com.google.android.exoplayer2.metadata")decoderFactory)

Deprecated.

Creates an instance. Parameters:output - The output.outputLooper - The looper associated with the thread on which the output should be called. If the output makes use of standard Android UI components, then this should normally be the looper associated with the application's main thread, which can be obtained using ContextWrapper.getMainLooper(). Null may be passed if the output should be called directly on the player's internal rendering thread.decoderFactory - A factory from which to obtain MetadataDecoder instances.

- 

MetadataRenderer

public MetadataRenderer​([MetadataOutput](MetadataOutput.html "interface in com.google.android.exoplayer2.metadata")output,
                        @Nullable[Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")outputLooper,[MetadataDecoderFactory](MetadataDecoderFactory.html "interface in com.google.android.exoplayer2.metadata")decoderFactory,
                        boolean outputMetadataEarly)

Deprecated.

Creates an instance. Parameters:output - The output.outputLooper - The looper associated with the thread on which the output should be called. If the output makes use of standard Android UI components, then this should normally be the looper associated with the application's main thread, which can be obtained using ContextWrapper.getMainLooper(). Null may be passed if the output should be called directly on the player's internal rendering thread.decoderFactory - A factory from which to obtain MetadataDecoder instances.outputMetadataEarly - Whether the renderer outputs metadata early. When true, render(long, long) will output metadata as soon as they are available to the renderer, otherwise render(long, long) will output metadata in sync with the rendering position.

Method Detail

- 

getName

public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getName()

Deprecated.

Description copied from interface: Renderer

Returns the name of this renderer, for logging and debugging purposes. Should typically be the renderer's (un-obfuscated) class name. Specified by:getName in interface RendererSpecified by:getName in interface RendererCapabilitiesReturns:The name of this renderer.

- 

supportsFormat

public @com.google.android.exoplayer2.RendererCapabilities.Capabilities int supportsFormat​([Format](../Format.html "class in com.google.android.exoplayer2")format)

Deprecated.

Description copied from interface: RendererCapabilities

Returns the extent to which the Renderer supports a given format. Specified by:supportsFormat in interface RendererCapabilitiesParameters:format - The format.Returns:The RendererCapabilities.Capabilities for this format.

- 

onStreamChanged

protected void onStreamChanged​([Format](../Format.html "class in com.google.android.exoplayer2")[] formats,
                               long startPositionUs,
                               long offsetUs)

Deprecated.

Description copied from class: BaseRenderer

Called when the renderer's stream has changed. This occurs when the renderer is enabled after BaseRenderer.onEnabled(boolean, boolean) has been called, and also when the stream has been replaced whilst the renderer is enabled or started.

The default implementation is a no-op.

Overrides:onStreamChanged in class BaseRendererParameters:formats - The enabled formats.startPositionUs - The start position of the new stream in renderer time (microseconds).offsetUs - The offset that will be added to the timestamps of buffers read via BaseRenderer.readSource(com.google.android.exoplayer2.FormatHolder, com.google.android.exoplayer2.decoder.DecoderInputBuffer, @com.google.android.exoplayer2.source.SampleStream.ReadFlags int) so that decoder input buffers have monotonically increasing timestamps.

- 

onPositionReset

protected void onPositionReset​(long positionUs,
                               boolean joining)

Deprecated.

Description copied from class: BaseRenderer

Called when the position is reset. This occurs when the renderer is enabled after BaseRenderer.onStreamChanged(Format[], long, long) has been called, and also when a position discontinuity is encountered.

After a position reset, the renderer's SampleStream is guaranteed to provide samples starting from a key frame.

The default implementation is a no-op.

Overrides:onPositionReset in class BaseRendererParameters:positionUs - The new playback position in microseconds.joining - Whether this renderer is being enabled to join an ongoing playback.

- 

render

public void render​(long positionUs,
                   long elapsedRealtimeUs)

Deprecated.

Description copied from interface: Renderer

Incrementally renders the SampleStream.

If the renderer is in the Renderer.STATE_ENABLED state then each call to this method will do work toward being ready to render the SampleStream when the renderer is started. If the renderer is in the Renderer.STATE_STARTED state then calls to this method will render the SampleStream in sync with the specified media positions.

The renderer may also render the very start of the media at the current position (e.g. the first frame of a video stream) while still in the Renderer.STATE_ENABLED state, unless it's the initial start of the media after calling Renderer.enable(RendererConfiguration, Format[], SampleStream, long, boolean, boolean, long, long) with mayRenderStartOfStream set to false.

This method should return quickly, and should not block if the renderer is unable to make useful progress.

This method may be called when the renderer is in the following states: Renderer.STATE_ENABLED, Renderer.STATE_STARTED.

Specified by:render in interface RendererParameters:positionUs - The current media time in microseconds, measured at the start of the current iteration of the rendering loop.elapsedRealtimeUs - SystemClock.elapsedRealtime() in microseconds, measured at the start of the current iteration of the rendering loop.

- 

onDisabled

protected void onDisabled()

Deprecated.

Description copied from class: BaseRenderer

Called when the renderer is disabled.

The default implementation is a no-op.

Overrides:onDisabled in class BaseRenderer

- 

isEnded

public boolean isEnded()

Deprecated.

Description copied from interface: Renderer

Whether the renderer is ready for the ExoPlayer instance to transition to Player.STATE_ENDED. The player will make this transition as soon as true is returned by all of its renderers.

This method may be called when the renderer is in the following states: Renderer.STATE_ENABLED, Renderer.STATE_STARTED.

Specified by:isEnded in interface RendererReturns:Whether the renderer is ready for the player to transition to the ended state.

- 

isReady

public boolean isReady()

Deprecated.

Description copied from interface: Renderer

Whether the renderer is able to immediately render media from the current position.

If the renderer is in the Renderer.STATE_STARTED state then returning true indicates that the renderer has everything that it needs to continue playback. Returning false indicates that the player should pause until the renderer is ready.

If the renderer is in the Renderer.STATE_ENABLED state then returning true indicates that the renderer is ready for playback to be started. Returning false indicates that it is not.

This method may be called when the renderer is in the following states: Renderer.STATE_ENABLED, Renderer.STATE_STARTED.

Specified by:isReady in interface RendererReturns:Whether the renderer is ready to render media.

- 

handleMessage

public boolean handleMessage​([Message](https://developer.android.com/reference/android/os/Message.html "class or interface in android.os")msg)

Deprecated. Specified by:handleMessage in interface Handler.Callback