# Metadata

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/Metadata.java+class:androidx.media3.common.Metadata)

*** ** * ** ***

<br />

```
@UnstableApi
public final class Metadata
```

<br />

*** ** * ** ***

A collection of metadata entries.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` A metadata entry. |

| ### Public fields |
|---|---|
| `final long` | `https://developer.android.com/reference/androidx/media3/common/Metadata#presentationTimeUs()` The presentation time of the metadata, in microseconds. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/common/Metadata#Metadata(androidx.media3.common.Metadata.Entry...)(Metadata.Entry[] entries)` |
| `https://developer.android.com/reference/androidx/media3/common/Metadata#Metadata(java.util.List<? extends androidx.media3.common.Metadata.Entry>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Metadata.Entry> entries)` |
| `https://developer.android.com/reference/androidx/media3/common/Metadata#Metadata(long,androidx.media3.common.Metadata.Entry...)(long presentationTimeUs, Metadata.Entry[] entries)` |
| `https://developer.android.com/reference/androidx/media3/common/Metadata#Metadata(long,java.util.List<? extends androidx.media3.common.Metadata.Entry>)(long presentationTimeUs, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Metadata.Entry> entries)` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Metadata` | `https://developer.android.com/reference/androidx/media3/common/Metadata#copyWithAppendedEntries(androidx.media3.common.Metadata.Entry...)(Metadata.Entry[] entriesToAppend)` Returns a copy of this metadata with the specified entries appended. |
| `https://developer.android.com/reference/androidx/media3/common/Metadata` | `https://developer.android.com/reference/androidx/media3/common/Metadata#copyWithAppendedEntriesFrom(androidx.media3.common.Metadata)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/Metadata other)` Returns a copy of this metadata with the entries of the specified metadata appended. |
| `https://developer.android.com/reference/androidx/media3/common/Metadata` | `https://developer.android.com/reference/androidx/media3/common/Metadata#copyWithPresentationTimeUs(long)(long presentationTimeUs)` Returns a copy of this metadata with the specified presentation time. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Metadata#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html obj)` |
| `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` | `https://developer.android.com/reference/androidx/media3/common/Metadata#get(int)(int index)` Returns the entry at the specified index. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<T>` | `<T extends https://developer.android.com/reference/androidx/media3/common/Metadata.Entry> https://developer.android.com/reference/androidx/media3/common/Metadata#getEntriesOfType(java.lang.Class<T>)(https://developer.android.com/reference/java/lang/Class.html<T> clazz)` Returns the entries of type (or subtype of) `clazz`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable T` | `<T extends https://developer.android.com/reference/androidx/media3/common/Metadata.Entry> https://developer.android.com/reference/androidx/media3/common/Metadata#getFirstEntryOfType(java.lang.Class<T>)(https://developer.android.com/reference/java/lang/Class.html<T> clazz)` Returns the first entry of type (or subtype of) `clazz`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable T` | `<T extends https://developer.android.com/reference/androidx/media3/common/Metadata.Entry> https://developer.android.com/reference/androidx/media3/common/Metadata#getFirstMatchingEntry(java.lang.Class<T>,com.google.common.base.Predicate<T>)( https://developer.android.com/reference/java/lang/Class.html<T> clazz, https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Predicate.html<T> predicate )` Returns the first entry of type (or subtype of) `clazz` that satisfies `predicate`. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<T>` | `<T extends https://developer.android.com/reference/androidx/media3/common/Metadata.Entry> https://developer.android.com/reference/androidx/media3/common/Metadata#getMatchingEntries(java.lang.Class<T>,com.google.common.base.Predicate<T>)( https://developer.android.com/reference/java/lang/Class.html<T> clazz, https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Predicate.html<T> predicate )` Returns the entries of type (or subtype of) `clazz` that satisfy `predicate`. |
| `int` | `https://developer.android.com/reference/androidx/media3/common/Metadata#hashCode()()` |
| `int` | `https://developer.android.com/reference/androidx/media3/common/Metadata#length()()` Returns the number of metadata entries. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/Metadata#toString()()` |

## Public fields

### presentationTimeUs

```
public final long presentationTimeUs
```

The presentation time of the metadata, in microseconds.

This time is an offset from the start of the current `https://developer.android.com/reference/androidx/media3/common/Timeline.Period`.

This time is `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` when not known or undefined.

## Public constructors

### Metadata

```
public Metadata(Metadata.Entry[] entries)
```

| Parameters |
|---|---|
| `Metadata.Entry[] entries` | The metadata entries. |

### Metadata

```
public Metadata(List<Metadata.Entry> entries)
```

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Metadata.Entry> entries` | The metadata entries. |

### Metadata

```
public Metadata(long presentationTimeUs, Metadata.Entry[] entries)
```

| Parameters |
|---|---|
| `long presentationTimeUs` | The presentation time for the metadata entries. |
| `Metadata.Entry[] entries` | The metadata entries. |

### Metadata

```
public Metadata(long presentationTimeUs, List<Metadata.Entry> entries)
```

| Parameters |
|---|---|
| `long presentationTimeUs` | The presentation time for the metadata entries. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Metadata.Entry> entries` | The metadata entries. |

## Public methods

### copyWithAppendedEntries

```
public Metadata copyWithAppendedEntries(Metadata.Entry[] entriesToAppend)
```

Returns a copy of this metadata with the specified entries appended.

| Parameters |
|---|---|
| `Metadata.Entry[] entriesToAppend` | The entries to append. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Metadata` | The metadata instance with the appended entries. |

### copyWithAppendedEntriesFrom

```
public Metadata copyWithAppendedEntriesFrom(@Nullable Metadata other)
```

Returns a copy of this metadata with the entries of the specified metadata appended. Returns this instance if `other` is null.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/Metadata other` | The metadata that holds the entries to append. If null, this methods returns this instance. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Metadata` | The metadata instance with the appended entries. |

### copyWithPresentationTimeUs

```
public Metadata copyWithPresentationTimeUs(long presentationTimeUs)
```

Returns a copy of this metadata with the specified presentation time.

| Parameters |
|---|---|
| `long presentationTimeUs` | The new presentation time, in microseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Metadata` | The metadata instance with the new presentation time. |

### equals

```
public boolean equals(@Nullable Object obj)
```

### get

```
public Metadata.Entry get(int index)
```

Returns the entry at the specified index.

| Parameters |
|---|---|
| `int index` | The index of the entry. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` | The entry at the specified index. |

### getEntriesOfType

```
public ImmutableList<T> <T extends Metadata.Entry> getEntriesOfType(Class<T> clazz)
```

Returns the entries of type (or subtype of) `clazz`.

### getFirstEntryOfType

```
public @Nullable T <T extends Metadata.Entry> getFirstEntryOfType(Class<T> clazz)
```

Returns the first entry of type (or subtype of) `clazz`.

### getFirstMatchingEntry

```
public @Nullable T <T extends Metadata.Entry> getFirstMatchingEntry(
    Class<T> clazz,
    Predicate<T> predicate
)
```

Returns the first entry of type (or subtype of) `clazz` that satisfies `predicate`.

### getMatchingEntries

```
public ImmutableList<T> <T extends Metadata.Entry> getMatchingEntries(
    Class<T> clazz,
    Predicate<T> predicate
)
```

Returns the entries of type (or subtype of) `clazz` that satisfy `predicate`.

### hashCode

```
public int hashCode()
```

### length

```
public int length()
```

Returns the number of metadata entries.

### toString

```
public String toString()
```