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.
MediaResource by passing information about the media to the
MediaResource constructor requires the following parameters:
|url||A string representing the URL of the manifest/playlist of the media.|
|type|| One of the following members of the MediaResource.Type enum, corresponding to the indicated file type:
|metadata||An instance of the Metadata class (a dictionary-like structure), which might contain additional information about the content that is about to be loaded, such as alternate or ad content to place inside the main content. If using advertising, set up AuditudeSettings before using this constructor 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 MediaResource res = new MediaResource( "https://www.example.com/video/some-video.m3u8", MediaResource.Type.HLS, metadata);
At any time after this step, you can use
MediaResource accessors (getters) to examine the resource’s type, URL, and metadata.
Load the media resource using one of the following options:
MediaPlayerItemLoaderFor more information, see Load a media resource using MediaPlayerItemLoader.
Do not load the media resource on a background thread. Most TVSDK operations need to run on the main thread, and running them on a background thread can cause the operation to throw an error and exit.