Package com.brightcove.player.util
Class MediaSourceUtil
java.lang.Object
com.brightcove.player.util.MediaSourceUtil
Provides utility method to work with
DashManifest and HlsMultivariantPlaylist.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic android.net.UrifindInitializationUri(com.google.android.exoplayer2.source.dash.manifest.Representation representation) Finds the location of the representation's initialization data.static StringfindRenditionUrl(com.google.android.exoplayer2.source.dash.manifest.DashManifest dashManifest, int trackType, com.google.android.exoplayer2.Format format) Finds the rendition url from theDashManifestobject for the specified track type and the format.static StringfindRenditionUrl(com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist hlsMasterPlaylist, int trackType, com.google.android.exoplayer2.Format format) Deprecated.static StringfindRenditionUrl(com.google.android.exoplayer2.source.hls.playlist.HlsMultivariantPlaylist hlsMasterPlaylist, int trackType, com.google.android.exoplayer2.Format format) Finds the rendition url from theHlsMultivariantPlaylistobject for the specified track type and the format.static StringfindRenditionUrl(Object manifest, int trackType, com.google.android.exoplayer2.Format format) Finds the rendition url from the manifest object given the track type and the format.static StringfindRenditionUrl(Object manifest, com.google.android.exoplayer2.Format format) Finds the rendition url from the manifest object given the track type and the format.static intfindTrackType(com.google.android.exoplayer2.Format format) Finds the track type of the specified format.static intgetBrightcoveRoleFlag(String roleValue) Gets the Brightcove Role Flag matching the Role Value.static StringgetBrightcoveRoleValue(int flag) Gets the Brightcove Role Value matching the Role Flag.static booleanisAudioOnly(com.google.android.exoplayer2.TracksInfo tracksInfo) Check if theTracksInfohas an audio track and no video track.
-
Constructor Details
-
MediaSourceUtil
public MediaSourceUtil()
-
-
Method Details
-
findTrackType
public static int findTrackType(@NonNull com.google.android.exoplayer2.Format format) Finds the track type of the specified format.- Parameters:
format- the format.- Returns:
- the track type.
-
findRenditionUrl
@Nullable public static String findRenditionUrl(@Nullable Object manifest, int trackType, @NonNull com.google.android.exoplayer2.Format format) Finds the rendition url from the manifest object given the track type and the format. The Manifest object needs to be an instance of eitherDashManifestorHlsManifest.- Parameters:
manifest- the manifesttrackType- the track typeformat- the format- Returns:
- the rendition url if found, null otherwise.
-
findRenditionUrl
@Nullable public static String findRenditionUrl(@Nullable Object manifest, @NonNull com.google.android.exoplayer2.Format format) Finds the rendition url from the manifest object given the track type and the format. The Manifest object needs to be an instance of eitherDashManifestorHlsManifest.- Parameters:
manifest- the manifestformat- the format- Returns:
- the rendition url if found, null otherwise.
-
findRenditionUrl
@Nullable public static String findRenditionUrl(@NonNull com.google.android.exoplayer2.source.dash.manifest.DashManifest dashManifest, int trackType, @NonNull com.google.android.exoplayer2.Format format) Finds the rendition url from theDashManifestobject for the specified track type and the format.- Parameters:
dashManifest- reference to the DASH manifest.trackType- the track typeformat- the format- Returns:
- the rendition url if found, null otherwise.
-
findInitializationUri
@NonNull public static android.net.Uri findInitializationUri(@NonNull com.google.android.exoplayer2.source.dash.manifest.Representation representation) Finds the location of the representation's initialization data. If the representation includes index data stored adjacent to the initialization uri, the returned URI can be used to request both in the same request.- Parameters:
representation- reference to the representation- Returns:
- fully qualified URI to the representation's initialization data.
-
findRenditionUrl
@Nullable @Deprecated public static String findRenditionUrl(@NonNull com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist hlsMasterPlaylist, int trackType, @NonNull com.google.android.exoplayer2.Format format) Deprecated. -
findRenditionUrl
@Nullable public static String findRenditionUrl(@NonNull com.google.android.exoplayer2.source.hls.playlist.HlsMultivariantPlaylist hlsMasterPlaylist, int trackType, @NonNull com.google.android.exoplayer2.Format format) Finds the rendition url from theHlsMultivariantPlaylistobject for the specified track type and the format.- Parameters:
hlsMasterPlaylist- reference to the HLS master playlist.trackType- the track typeformat- the format- Returns:
- the rendition url if found, null otherwise.
-
getBrightcoveRoleFlag
Gets the Brightcove Role Flag matching the Role Value. TheBrightcoveDashManifestParserreads the AdaptationSet Role value and adds a Brightcove Flag to theFormat.selectionFlags, depending on the Role value.- Parameters:
roleValue- the role string value- Returns:
- the Brightcove Role flag
-
getBrightcoveRoleValue
Gets the Brightcove Role Value matching the Role Flag. TheBrightcoveDashManifestParserreads the AdaptationSet Role value and adds a Brightcove Flag to theFormat.selectionFlags, depending on the Role value.- Parameters:
flag- the Brightcove Role Flag- Returns:
- the Brightcove role value
-
isAudioOnly
@RestrictTo(LIBRARY) public static boolean isAudioOnly(com.google.android.exoplayer2.TracksInfo tracksInfo) Check if theTracksInfohas an audio track and no video track.- Parameters:
tracksInfo- The available tracks information.- Returns:
- True if the track is audio-only.
-
findRenditionUrl(HlsMultivariantPlaylist, int, Format)instead