MediaPlayer and MediaResource classes

A MediaResource represents the content that is about to be loaded by the MediaPlayer instance.

The PSDK library provides a simple means to load and prepare content for playback via the replaceCurrentItem method in the MediaPlayer interface. This method receives as the sole input argument an instance of the MediaResource class. The MediaResource class brings together the following information:
  • A URL: This represents the location of the content that is about to be loaded.

  • A type: This is the type of content that is about to be loaded. This is a simple enumeration in the MediaResource class that defines the types of content that can be loaded by the MediaPlayer. Possible values are HLS and HDS. Each value is associated with the string representing the file extensions commonly used, “m3u8” for HLS and “f4m” for HDS.

  • Some metadata: An instance of the Metadata class (basically a dictionary-like structure). This structure may contain additional information about the content that is about to be loaded (such as information about the alternate/ad- content that should be placed inside the main content).

The metadata is the venue through which information related to alternate content is passed on to the PSDK. The Metadata interface defines the API for a generic key-value store, where both the key and the value are plain strings.