mediaOption Parameters

How to use mediaoption parameters

  1. Create an object for mediaOption and set additional information.

    // HTML code
    <video id="myVideo" ...>
    </video>
    // JavaScript code
    var options = {};
    options.mediaTransportType = "PLAYREADY";
    options.option = {};
    options.option.drm = {};
    options.option.drm.type = drmType;
    ...
    options.option.transmission = {};
    options.option.transmission.playTime = {};
    options.option.transmission.playTime.start = start * 1000;
  2. Convert the created object to JSON string and encode it.

    var mediaOption = encodeURI(JSON.stringify(options));
  3. Create the source element.

    var source = document.createElement("source");
  4. Add attributes to the created source element for media content.

    var dataURL = "quot;http://example.com/test.mp4";
    source.setAttribute('src', dataURL);
  5. Add the escaped string to type attribute as below:

    source.setAttribute('type', 'video/mp4;mediaOption=' + mediaOption);
  6. Add the created source element to a video element or audio element.

    video = document.getElementById('myVideo');
    video.appendChild(source)

mediaOption reference

The following table describes the parameters of the mediaOption.

ParameterRequiredData TypeDescription
mediaTransportType
Optional
string
Code of Media Transport Types. The player type is decided by this code. This property is set automatically. For more details, See Media Transport Types. The default value is URI.
option
Optional
object
The object that holds additional information for each media transport type.
option.mediaFormat
Optional
object
The object that holds information of media format.
option.mediaFormat.type
Optional
string
The string that sets media type. The default value is video.
  • "audio": audio
  • "video": video/audio
  • "video_only": video only
  • "audio_test": audio only for test
option.drm
Optional
object
Object that holds DRM information.
option.drm.type
Optional
string
Type of DRM.
  • "playready"
option.drm.clientId
Optional
string
The Client ID that was sent to the app from DRM service. Set this property only when client ID exists that DRM service sent.
option.transmission
Optional
object
The object that holds information of media content which is specific by server type and transmission protocol. This object is sent to the media pipeline.
option.transmission.playTime
Optional
object
The object that holds play time-related parameter.
option.transmission.playTime.start
Optional
number
Start time (millisecond) for resuming media.
option.adaptiveStreaming
Optional
object
The object that holds information of network transmission status.
option.adaptiveStreaming.audioOnly
Optional
boolean
The flag that indicates streaming mode. This property can be used when transmitting the audio-only streaming (such as music service or radio service) with HLS protocol. The default value is false.
  • true: audio only
  • false: video/audio
option.adaptiveStreaming.adaptiveResolution
Optional
boolean
The flag that indicates whether screen ratio can be changed by network status. The default value is false.
  • true: changeable
  • false: unchangeable
option.adaptiveStreaming.seamlessPlay
Optional
boolean
Flag whether content supports seamless play. The default value is false.
  • true: support seamless play
  • false: not support
option.adaptiveStreaming.maxWidth
Optional
number
The maximum screen width of the content. The default value is 1920.
option.adaptiveStreaming.maxHeight
Optional
number
Maximum screen height of the content. The default value is 1080.
option.adaptiveStreaming.bps
Optional
object
The object that holds information to control network transmit speed.
option.adaptiveStreaming.bps.start
Optional
number
Starting speed of network transmission (bps).Note that for HLS, this parameter is supported on webOS TV 3.0 or later.

Media transport types

The following table describes media transport types.

Media Transport TypeDescription
URI
URI is a general playing type. This type plays the content of URI.
HLS
Plays contents with HLS protocol. Following MIME types set the Media Transport Type to HLS automatically when src property contains "m3u8" file extension:
  • application/vnd.apple.mpegurl
  • application/mpegurl
  • application/x-mpegurl
  • application/vnd.apple.mpegurl.audio
  • audio/mpegurl
  • audio/x-mpegurl

No Headings