com.adobe.mediacore
Class MediaResource

java.lang.Object
  extended by com.adobe.mediacore.MediaResource

public final class MediaResource
extends Object

Class wrapping all information about a media resource.


Nested Class Summary
static class MediaResource.MimeType
          The mime resource type.
static class MediaResource.Type
          The resource type.
 
Constructor Summary
MediaResource(String url, MediaResource.Type type, Metadata metadata)
          Default constructor.
 
Method Summary
static MediaResource createFromMetadata(Metadata metadata, MediaResource.Type type)
           
static MediaResource createFromUrl(String url, Metadata metadata)
          Helper function for creating a media resource instance.
 boolean equals(MediaResource otherMediaResource)
          Checks if is equal with other media resource.
 Metadata getMetadata()
          Resource custom information.
 MediaResource.Type getType()
          Type of the media resource.
 String getUrl()
          URL where the media manifest/playlist can be found.
 String toString()
          Returns a String representation of the current media resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MediaResource

public MediaResource(String url,
                     MediaResource.Type type,
                     Metadata metadata)
Default constructor.

Parameters:
url - the url where the manifest/playlist of media is available
type - the type of the resource.
metadata - the custom information associated with this resource
Method Detail

getUrl

public String getUrl()
URL where the media manifest/playlist can be found.

Returns:
the resource url.

getType

public MediaResource.Type getType()
Type of the media resource. Usually the type of the resource can be detected from the provided url, but sometimes when custom naming schemes are involved this is not possible.

Returns:
the media type.

getMetadata

public Metadata getMetadata()
Resource custom information.

Returns:
the metadata associated with this resource.

equals

public boolean equals(MediaResource otherMediaResource)
Checks if is equal with other media resource. The metadata property is ignored during comparison, only the url and the type are used.

Parameters:
otherMediaResource - the other media resource to be compared with.
Returns:
return true if both objects have the same urls and the same type and false otherwise.

toString

public String toString()
Returns a String representation of the current media resource. As a media resource can have a significant amount of custom metadata associated with it, we will not include metadata content in this representation.

Overrides:
toString in class Object
Returns:
a string containing the url and the type of the resource

createFromUrl

public static MediaResource createFromUrl(String url,
                                          Metadata metadata)
                                   throws IllegalArgumentException
Helper function for creating a media resource instance. If the type can't be inferred from the provided url, then the type will be Type.HLS

Parameters:
url - the url where the manifest/playlist of media is available
metadata - the custom information associated with this resource
Returns:
a new MediaResource instance
Throws:
IllegalArgumentException - if provided url is null or empty.

createFromMetadata

public static MediaResource createFromMetadata(Metadata metadata,
                                               MediaResource.Type type)