Create a media resource

Last update: 2023-10-02

For each new video content, initialize a MediaResource instance with information about the video content and load the 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

    A string that represents the URL of the manifest/playlist of the media.


    One of the following string values that corresponds to the indicated file type:

    • MP4 - ISO base media file format (MP4)
    • HLS - M3U8


    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.


    TVSDK supports playback for only specific types of content. If you attempt to load any other type of content, TVSDK dispatches an error event.

    For MP4 video-on-demand (VOD) content, TVSDK does not support trick play, adaptive bit rate (ABR) streaming, ad insertion, closed captions, or DRM.

    The following code creates a MediaResource instance:

    // To do: Create metadata here
    MyResource = new MediaResource(

    At this point, you can use MediaResource accessors (getters) to examine the resource’s type, URL, and metadata.

  2. Load the media resource by using one of the following:

On this page