@Immutable public class Media extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Media.HlsSegmentFormat
The format of a HLS audio segment.
|
static class |
Media.HlsVideoSegmentFormat
The format of a HLS video segment.
|
static class |
Media.MediaBuilder
A builder class for the
Media class. |
static class |
Media.MediaCategory
The media category.
|
static class |
Media.StreamType
Represents the stream types.
|
| Modifier and Type | Field and Description |
|---|---|
protected String |
contentId
Typically the URL of the media
|
protected String |
contentType
The content MIME-type
|
protected String |
contentUrl
Optional media URL, to allow using
contentId for real ID. |
protected Map<String,Object> |
customData
Application-specific media information
|
protected Double |
duration
The media duration
|
protected String |
entity
Optional Google Assistant deep link to a media entity
|
protected Media.HlsSegmentFormat |
hlsSegmentFormat
The format of the HLS audio segment
|
protected Media.HlsVideoSegmentFormat |
hlsVideoSegmentFormat
The format of the HLS video segment
|
protected Media.MediaCategory |
mediaCategory
The media cateory (audio, video, picture)
|
protected Map<String,Object> |
metadata
The media metadata
|
protected Long |
startAbsoluteTime
Provides absolute time (Epoch Unix time in seconds) for live streams.
|
protected Media.StreamType |
streamType
The stream type (required)
|
protected TextTrackStyle |
textTrackStyle
The style of text track
|
protected List<Track> |
tracks
The media tracks
|
| Constructor and Description |
|---|
Media(String contentId,
String contentType,
String contentUrl,
Map<String,Object> customData,
Double duration,
String entity,
Media.HlsSegmentFormat hlsSegmentFormat,
Media.HlsVideoSegmentFormat hlsVideoSegmentFormat,
Media.MediaCategory mediaCategory,
Map<String,Object> metadata,
Long startAbsoluteTime,
Media.StreamType streamType,
TextTrackStyle textTrackStyle,
List<Track> tracks)
Creates a new instance using the specified parameters.
|
@Nullable protected final String contentUrl
contentId for real ID. If
contentUrl is provided, it will be used as media the URL,
otherwise contentId will be used as the media URL.@Nonnull protected final Map<String,Object> customData
protected final Double duration
protected final String entity
protected final Media.HlsSegmentFormat hlsSegmentFormat
protected final Media.HlsVideoSegmentFormat hlsVideoSegmentFormat
protected final Media.MediaCategory mediaCategory
@Nullable protected final Long startAbsoluteTime
@Nonnull protected final Media.StreamType streamType
@Nullable protected final TextTrackStyle textTrackStyle
public Media(String contentId, String contentType, String contentUrl, Map<String,Object> customData, Double duration, String entity, Media.HlsSegmentFormat hlsSegmentFormat, Media.HlsVideoSegmentFormat hlsVideoSegmentFormat, Media.MediaCategory mediaCategory, Map<String,Object> metadata, Long startAbsoluteTime, Media.StreamType streamType, TextTrackStyle textTrackStyle, List<Track> tracks)
contentId - the content ID, typically the URL of the media
(required).contentType - the content MIME-type.contentUrl - the optional media URL, to allow using
contentId for real ID. If contentUrl is
provided, it will be used as media the URL, otherwise
contentId will be used as the media URL.customData - the application-specific media information.duration - the media duration.entity - the optional Google Assistant deep link to a media entity.hlsSegmentFormat - the format of the HLS audio segment.hlsVideoSegmentFormat - the format of the HLS video segment.mediaCategory - the media category.metadata - the media metadata.startAbsoluteTime - the absolute time (Epoch Unix time in seconds)
for live streams. For live event it would be the time the
event started, otherwise it will be start of the seekable
range when the streaming started.streamType - the stream type (required).textTrackStyle - the style of text track.tracks - the media Tracks.@Nonnull public String getContentId()
@Nullable public String getContentUrl()
contentId for real
ID. If contentUrl is provided, it will be used as media
the URL, otherwise contentId will be used as the media
URL.@Nullable public String getUrl()
contentId
or contentUrl. The "rules" is that contentUrl is the URL
if it is populated, otherwise contentId is the URL.
This method returns the URL for this Media instance according to
these rules.
Media or null if none is
defined.@Nonnull public Map<String,Object> getCustomData()
@Nullable public String getEntity()
@Nullable public Media.HlsSegmentFormat getHlsSegmentFormat()
@Nullable public Media.HlsVideoSegmentFormat getHlsVideoSegmentFormat()
@Nullable public Media.MediaCategory getMediaCategory()
@Nullable public Long getStartAbsoluteTime()
@Nonnull public Media.StreamType getStreamType()
@Nullable public TextTrackStyle getTextTrackStyle()
@Nullable public Metadata.MetadataType getMetadataType()
Metadata.MetadataType defined by the key
Metadata.METADATA_TYPE or null.@Nonnull public Media.MediaBuilder modify()
Media.MediaBuilder initialized with the information from
this Media.Media.MediaBuilder.public static Media.MediaBuilder builder(@Nullable String contentUrl, @Nonnull String contentType, @Nonnull Media.StreamType streamType)
Media.MediaBuilder using the specified parameters.contentUrl - the URL of the media content.contentType - the content MIME-type.streamType - the stream type.Media.MediaBuilder.Copyright © 2022. All rights reserved.