Create a media resource
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.
- Create a MediaResource by passing information about the media to the MediaResource constructor.
Constructor Parameter Description urlA string that represents the URL of the manifest/playlist of the media. typeOne of the following string values that corresponds to the indicated file type:
- MP4 - ISO base media file format (MP4)
- HLS - M3U8
metadataAn 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( "https://www.example.com/video/some-video.m3u8", "HLS", MyMetadata)At this point, you can use MediaResource accessors (getters) to examine the resource's type, URL, and metadata.
- Load the media resource by using one of the following: