Show Menu
TOPICS×

Create a media resource

The MediaResource class represents the content to be loaded by the MediaPlayer instance.
  1. Create a MediaResource by passing information about the media to the MediaResource constructor.
    Constructor Parameter Description
    url
    A string that represents the URL of the manifest/playlist of the media.
    type
    One of the following members of the MediaResource.Type enumeration that corresponds to the indicated file type:
    • MP4 - ISO base media file format (MP4)
    • HLS - M3U8
    • DASH - MPD
    metadata
    An instance of the Metadata class, which might contain custom information about the content to be loaded. Examples of content are alternate or ad content to place inside the main content. If using advertising, set up AuditudeSettings before using this constructor. For more information, see Ad-insertion-metadata .
    Tip: You can force Flash fallback, if necessary, by using the forceFlash parameter when creating a media resource. This can be useful because currently not all of the features (such as Live Ad workflows) are supported in Browser TVSDK. Flash fallback is used to play video content.
    Browser TVSDK supports playback for only specific types of content. If you attempt to load any other type of content, Browser TVSDK dispatches an error event.
    The following code creates a MediaResource instance:
    //create a MediaResource instance pointing to some HLS content 
    Metadata metadata = //TODO: create metadata here 
    mediaResource = new AdobePSDK.MediaResource ( 
          "https://www.example.com/video/some-video.m3u8", 
          AdobePSDK.MediaResourceType.HLS,  
          metadata);
    
    
    At any time after this, you can use MediaResource accessors (getters) to examine the resource's type, URL, and metadata.
  2. Load your MediaPlayer instance. For more information, see Load a media resource in the MediaPlayer .