Back to Exoplayer

MediaItem (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/MediaItem.html

latest13.4 KB
Original Source

Package com.google.android.exoplayer2

Class MediaItem

  • java.lang.Object

    • com.google.android.exoplayer2.MediaItem
  • All Implemented Interfaces:Bundleable


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classMediaItemextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Bundleable](Bundleable.html "interface in com.google.android.exoplayer2")

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.

Representation of a media item.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static class | MediaItem.AdsConfiguration | Deprecated.

Configuration for playing back linear ads with a media item. | | static class | MediaItem.Builder | Deprecated.

A builder for MediaItem instances. | | static class | MediaItem.ClippingConfiguration | Deprecated.

Optionally clips the media item to a custom start and end position. | | static class | MediaItem.ClippingProperties | Deprecated. Use MediaItem.ClippingConfiguration instead.

| | static class | MediaItem.DrmConfiguration | Deprecated.

DRM configuration for a media item. | | static class | MediaItem.LiveConfiguration | Deprecated.

Live playback configuration. | | static class | MediaItem.LocalConfiguration | Deprecated.

Properties for local playback. | | static class | MediaItem.RequestMetadata | Deprecated.

Metadata that helps the player to understand a playback request represented by a MediaItem. | | static class | MediaItem.Subtitle | Deprecated. Use MediaItem.SubtitleConfiguration instead

| | static class | MediaItem.SubtitleConfiguration | Deprecated.

Properties for a text track. |

- 

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

Bundleable.Creator<T extends Bundleable>

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | MediaItem.ClippingConfiguration | clippingConfiguration | Deprecated.

The clipping properties. | | MediaItem.ClippingProperties | clippingProperties | Deprecated. Use clippingConfiguration instead.

| | static Bundleable.Creator<MediaItem> | CREATOR | Deprecated.

An object that can restore MediaItem from a Bundle. | | static String | DEFAULT_MEDIA_ID | Deprecated.

The default media ID that is used if the media ID is not explicitly set by MediaItem.Builder.setMediaId(String). | | static MediaItem | EMPTY | Deprecated.

Empty MediaItem. | | MediaItem.LiveConfiguration | liveConfiguration | Deprecated.

The live playback configuration. | | MediaItem.LocalConfiguration | localConfiguration | Deprecated.

Optional configuration for local playback. | | String | mediaId | Deprecated.

Identifies the media item. | | MediaMetadata | mediaMetadata | Deprecated.

The media metadata. | | MediaItem.LocalConfiguration | playbackProperties | Deprecated. Use localConfiguration instead.

| | MediaItem.RequestMetadata | requestMetadata | Deprecated.

The media MediaItem.RequestMetadata. |

Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | MediaItem.Builder | buildUpon() | Deprecated.

Returns a MediaItem.Builder initialized with the values of this instance. | | boolean | equals​(Object obj) | Deprecated. | | static MediaItem | fromUri​(Uri uri) | Deprecated.

Creates a MediaItem for the given URI. | | static MediaItem | fromUri​(String uri) | Deprecated.

Creates a MediaItem for the given URI. | | int | hashCode() | Deprecated. | | Bundle | toBundle() | Deprecated.

Returns a Bundle representing the information stored in this object. | | Bundle | toBundleIncludeLocalConfiguration() | Deprecated.

Returns a Bundle representing the information stored in this MediaItem(java.lang.String, com.google.android.exoplayer2.MediaItem.ClippingProperties, com.google.android.exoplayer2.MediaItem.LocalConfiguration, com.google.android.exoplayer2.MediaItem.LiveConfiguration, com.google.android.exoplayer2.MediaMetadata, com.google.android.exoplayer2.MediaItem.RequestMetadata) object, while including the localConfiguration field if it is not null (otherwise skips it). |

- 

Methods inherited from class java.lang.Object

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

Field Detail

- 

DEFAULT_MEDIA_ID

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

Deprecated.

The default media ID that is used if the media ID is not explicitly set by MediaItem.Builder.setMediaId(String). See Also:Constant Field Values

- 

EMPTY

public static final[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")EMPTY

Deprecated.

Empty MediaItem.

- 

mediaId

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

Deprecated.

Identifies the media item.

- 

localConfiguration

@Nullable
public final[MediaItem.LocalConfiguration](MediaItem.LocalConfiguration.html "class in com.google.android.exoplayer2")localConfiguration

Deprecated.

Optional configuration for local playback. May be null if shared over process boundaries.

- 

playbackProperties

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")@Nullable
public final[MediaItem.LocalConfiguration](MediaItem.LocalConfiguration.html "class in com.google.android.exoplayer2")playbackProperties

Deprecated. Use localConfiguration instead.

- 

liveConfiguration

public final[MediaItem.LiveConfiguration](MediaItem.LiveConfiguration.html "class in com.google.android.exoplayer2")liveConfiguration

Deprecated.

The live playback configuration.

- 

mediaMetadata

public final[MediaMetadata](MediaMetadata.html "class in com.google.android.exoplayer2")mediaMetadata

Deprecated.

The media metadata.

- 

clippingConfiguration

public final[MediaItem.ClippingConfiguration](MediaItem.ClippingConfiguration.html "class in com.google.android.exoplayer2")clippingConfiguration

Deprecated.

The clipping properties.

- 

clippingProperties

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final[MediaItem.ClippingProperties](MediaItem.ClippingProperties.html "class in com.google.android.exoplayer2")clippingProperties

Deprecated. Use clippingConfiguration instead.

- 

requestMetadata

public final[MediaItem.RequestMetadata](MediaItem.RequestMetadata.html "class in com.google.android.exoplayer2")requestMetadata

Deprecated.

The media MediaItem.RequestMetadata.

- 

CREATOR

public static final[Bundleable.Creator](Bundleable.Creator.html "interface in com.google.android.exoplayer2")<[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")> CREATOR

Deprecated.

An object that can restore MediaItem from a Bundle.

The localConfiguration of a restored instance will always be null.

Method Detail

- 

fromUri

public static[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")fromUri​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")uri)

Deprecated.

Creates a MediaItem for the given URI. Parameters:uri - The URI.Returns:An MediaItem for the given URI.

- 

fromUri

public static[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")fromUri​([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri)

Deprecated.

Creates a MediaItem for the given URI. Parameters:uri - The uri.Returns:An MediaItem for the given URI.

- 

buildUpon

public[MediaItem.Builder](MediaItem.Builder.html "class in com.google.android.exoplayer2")buildUpon()

Deprecated.

Returns a MediaItem.Builder initialized with the values of this instance.

- 

equals

public boolean equals​(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")obj)

Deprecated. Overrides:equals in class Object

- 

hashCode

public int hashCode()

Deprecated. Overrides:hashCode in class Object

- 

toBundle

public[Bundle](https://developer.android.com/reference/android/os/Bundle.html "class or interface in android.os")toBundle()

Deprecated.

Returns a Bundle representing the information stored in this object.

It omits the localConfiguration field. The localConfiguration of an instance restored from such a bundle by CREATOR will be null.

Specified by:toBundle in interface Bundleable

- 

toBundleIncludeLocalConfiguration

public[Bundle](https://developer.android.com/reference/android/os/Bundle.html "class or interface in android.os")toBundleIncludeLocalConfiguration()

Deprecated.

Returns a Bundle representing the information stored in this MediaItem(java.lang.String, com.google.android.exoplayer2.MediaItem.ClippingProperties, com.google.android.exoplayer2.MediaItem.LocalConfiguration, com.google.android.exoplayer2.MediaItem.LiveConfiguration, com.google.android.exoplayer2.MediaMetadata, com.google.android.exoplayer2.MediaItem.RequestMetadata) object, while including the localConfiguration field if it is not null (otherwise skips it).