Support multiple metadata types in streams
Stay organized with collections
Save and categorize content based on your preferences.
For streams using two different types of metadata, you might need additional
configuration setup depending on your player implementation. A stream can
contain multiple types of metadata. The IMA SDK adds metadata to the stream to
retrieve ad information from the media. For example,
SCTE-35 is a common second
metadata type.
For apps using
Media3 ExoPlayer v1.6 or
higher, streams with two metadata types are handled by default.
For apps using an ExoPlayer version lower than v1.6, you must add an additional
MetadataRenderer
instance to your ExoPlayer implementation. The following example adds a
second MetadataRenderer
instance to support two metadata types:
RenderersFactory defaultRenderersFactory = new DefaultRenderersFactory(context) {
@Override
protected void buildMetadataRenderers(Context context, MetadataOutput output,
Looper outputLooper, @ExtensionRendererMode int extensionRendererMode,
ArrayList<Renderer> out) {
// Add a `MetadataRenderer` for each type of metadata. This example adds 2.
out.add(new MetadataRenderer(output, outputLooper));
out.add(new MetadataRenderer(output, outputLooper));
}
};
new ExoPlayer.Builder()
.setRenderersFactory(defaultRenderersFactory)
.setMediaSourceFactory(mediaSourceFactory)
.build();;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-28 UTC.
[null,null,["Last updated 2025-08-28 UTC."],[],[],null,["For streams using two different types of metadata, you might need additional\nconfiguration setup depending on your player implementation. A stream can\ncontain multiple types of metadata. The IMA SDK adds metadata to the stream to\nretrieve ad information from the media. For example,\n[SCTE-35](//support.google.com/admanager/answer/7506166) is a common second\nmetadata type.\n\nFor apps using\n[Media3 ExoPlayer](//developer.android.com/media/media3/exoplayer) v1.6 or\nhigher, streams with two metadata types are handled by default.\n\nFor apps using an ExoPlayer version lower than v1.6, you must add an additional\n[`MetadataRenderer`](//developer.android.com/reference/androidx/media3/exoplayer/metadata/MetadataRenderer)\ninstance to your ExoPlayer implementation. The following example adds a\nsecond `MetadataRenderer` instance to support two metadata types: \n\n RenderersFactory defaultRenderersFactory = new DefaultRenderersFactory(context) {\n\n @Override\n protected void buildMetadataRenderers(Context context, MetadataOutput output,\n Looper outputLooper, @ExtensionRendererMode int extensionRendererMode,\n ArrayList\u003cRenderer\u003e out) {\n // Add a `MetadataRenderer` for each type of metadata. This example adds 2.\n out.add(new MetadataRenderer(output, outputLooper));\n out.add(new MetadataRenderer(output, outputLooper));\n }\n };\n\n new ExoPlayer.Builder()\n .setRenderersFactory(defaultRenderersFactory)\n .setMediaSourceFactory(mediaSourceFactory)\n .build();;"]]