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
mediaTransportTypeOptionalstringCode 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.
optionOptionalobjectThe object that holds additional information for each media transport type.
option.mediaFormatOptionalobjectThe object that holds information of media format.
option.mediaFormat.typeOptionalstringThe 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.drmOptionalobjectObject that holds DRM information.
option.drm.typeOptionalstringType of DRM.
  • "playready"
option.drm.clientIdOptionalstringThe Client ID that was sent to the app from DRM service. Set this property only when client ID exists that DRM service sent.
option.transmissionOptionalobjectThe 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.playTimeOptionalobjectThe object that holds play time-related parameter.
option.transmission.playTime.startOptionalnumberStart time (millisecond) for resuming media.
option.adaptiveStreamingOptionalobjectThe object that holds information of network transmission status.
option.adaptiveStreaming.audioOnlyOptionalbooleanThe 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.adaptiveResolutionOptionalbooleanThe flag that indicates whether screen ratio can be changed by network status. The default value is false.
  • true: changeable
  • false: unchangeable
option.adaptiveStreaming.seamlessPlayOptionalbooleanFlag whether content supports seamless play. The default value is false.
  • true: support seamless play
  • false: not support
option.adaptiveStreaming.maxWidthOptionalnumberThe maximum screen width of the content. The default value is 1920.
option.adaptiveStreaming.maxHeightOptionalnumberMaximum screen height of the content. The default value is 1080.
option.adaptiveStreaming.bpsOptionalobjectThe object that holds information to control network transmit speed.
option.adaptiveStreaming.bps.startOptionalnumberStarting 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
URIURI is a general playing type. This type plays the content of URI.
HLSPlays 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