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 forMediaItem
instances.static class
MediaItem.ClippingConfiguration
Optionally clips the media item to a custom start and end position.static class
MediaItem.ClippingProperties
Deprecated.UseMediaItem.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.static class
MediaItem.Subtitle
Deprecated.UseMediaItem.SubtitleConfiguration
insteadstatic 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.UseclippingConfiguration
instead.static Bundleable.Creator<MediaItem>
CREATOR
static String
DEFAULT_MEDIA_ID
The default media ID that is used if the media ID is not explicitly set byMediaItem.Builder.setMediaId(String)
.static MediaItem
EMPTY
EmptyMediaItem
.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.UselocalConfiguration
instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MediaItem.Builder
buildUpon()
Returns aMediaItem.Builder
initialized with the values of this instance.boolean
equals(Object obj)
static MediaItem
fromUri(Uri uri)
static MediaItem
fromUri(String uri)
Creates aMediaItem
for the given URI.int
hashCode()
Bundle
toBundle()
Returns aBundle
representing the information stored in this object.
-
-
-
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 byMediaItem.Builder.setMediaId(String)
.- See Also:
- Constant Field Values
-
mediaId
public final String mediaId
Identifies the media item.
-
localConfiguration
@Nullable public final MediaItem.LocalConfiguration localConfiguration
Optional configuration for local playback. May benull
if shared over process boundaries.
-
playbackProperties
@Deprecated @Nullable public final MediaItem.PlaybackProperties playbackProperties
Deprecated.UselocalConfiguration
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.UseclippingConfiguration
instead.
-
CREATOR
public static final Bundleable.Creator<MediaItem> CREATOR
Object that can restoreMediaItem
from aBundle
.The
localConfiguration
of a restored instance will always benull
.
-
-
Method Detail
-
fromUri
public static MediaItem fromUri(String uri)
Creates aMediaItem
for the given URI.- Parameters:
uri
- The URI.- Returns:
- An
MediaItem
for the given URI.
-
buildUpon
public MediaItem.Builder buildUpon()
Returns aMediaItem.Builder
initialized with the values of this instance.
-
toBundle
public Bundle toBundle()
Returns aBundle
representing the information stored in this object.It omits the
localConfiguration
field. ThelocalConfiguration
of an instance restored byCREATOR
will always benull
.- Specified by:
toBundle
in interfaceBundleable
-
-