Package com.google.android.exoplayer2

## Class MediaItem

- java.lang.Object
- - com.google.android.exoplayer2.MediaItem

- All Implemented Interfaces:
    `Bundleable`

      public final class MediaItem
      extends Object
      implements Bundleable

  Representation of a media item.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `MediaItem.AdsConfiguration` | Configuration for playing back linear ads with a media item.
    `static class` | `MediaItem.Builder` | A builder for `MediaItem` instances.
    `static class` | `MediaItem.ClippingConfiguration` | 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` | DRM configuration for a media item.
    `static class` | `MediaItem.LiveConfiguration` | Live playback configuration.
    `static class` | `MediaItem.LocalConfiguration` | Properties for local playback.
    `static class` | `MediaItem.PlaybackProperties` | Deprecated. Use `MediaItem.LocalConfiguration`.
    `static class` | `MediaItem.RequestMetadata` | 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` | 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` | The clipping properties.
    `MediaItem.ClippingProperties` | `clippingProperties` | Deprecated. Use `clippingConfiguration` instead.
    `static Bundleable.Creator<MediaItem>` | `CREATOR` | Object that can restore `MediaItem` from a `Bundle`.
    `static String` | `DEFAULT_MEDIA_ID` | The default media ID that is used if the media ID is not explicitly set by `MediaItem.Builder.setMediaId(String)`.
    `static MediaItem` | `EMPTY` | Empty `MediaItem`.
    `MediaItem.LiveConfiguration` | `liveConfiguration` | The live playback configuration.
    `MediaItem.LocalConfiguration` | `localConfiguration` | Optional configuration for local playback.
    `String` | `mediaId` | Identifies the media item.
    `MediaMetadata` | `mediaMetadata` | The media metadata.
    `MediaItem.PlaybackProperties` | `playbackProperties` | Deprecated. Use `localConfiguration` instead.
    `MediaItem.RequestMetadata` | `requestMetadata` | The media `MediaItem.RequestMetadata`.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `MediaItem.Builder` | `buildUpon()` | Returns a `MediaItem.Builder` initialized with the values of this instance.
    `boolean` | `equals​(Object obj)` |
    `static MediaItem` | `fromUri​(Uri uri)` | Creates a `MediaItem` for the given `URI`.
    `static MediaItem` | `fromUri​(String uri)` | Creates a `MediaItem` for the given URI.
    `int` | `hashCode()` |
    `Bundle` | `toBundle()` | Returns a `Bundle` representing the information stored in this object.

    - ### 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 DEFAULT_MEDIA_ID

      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 EMPTY

      Empty `MediaItem`.

    - #### mediaId

          public final String mediaId

      Identifies the media item.

    - #### localConfiguration

          @Nullable
          public final MediaItem.LocalConfiguration localConfiguration

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

    - #### playbackProperties

          @Deprecated
          @Nullable
          public final MediaItem.PlaybackProperties playbackProperties

      Deprecated.
      Use `localConfiguration` instead.

    - #### liveConfiguration

          public final MediaItem.LiveConfiguration liveConfiguration

      The live playback configuration.

    - #### mediaMetadata

          public final MediaMetadata mediaMetadata

      The media metadata.

    - #### clippingConfiguration

          public final MediaItem.ClippingConfiguration clippingConfiguration

      The clipping properties.

    - #### clippingProperties

          @Deprecated
          public final MediaItem.ClippingProperties clippingProperties

      Deprecated.
      Use `clippingConfiguration` instead.

    - #### requestMetadata

          public final MediaItem.RequestMetadata requestMetadata

      The media `MediaItem.RequestMetadata`.

    - #### CREATOR

          public static final Bundleable.Creator<MediaItem> CREATOR

      Object that can restore `MediaItem` from a `Bundle`.

      The `localConfiguration` of a restored instance will always be `null`.

  - ### Method Detail

    - #### fromUri

          public static MediaItem fromUri​(String uri)

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

    - #### fromUri

          public static MediaItem fromUri​(Uri uri)

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

    - #### buildUpon

          public MediaItem.Builder buildUpon()

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

    - #### equals

          public boolean equals​(@Nullable
                                Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toBundle

          public Bundle toBundle()

      Returns a `Bundle` representing the information stored in this object.

      It omits the `localConfiguration` field. The `localConfiguration` of an instance restored by `CREATOR` will always be `null`.

      Specified by:
        `toBundle` in interface `Bundleable`