mediaOption Parameter

How to Use mediaOption Parameter

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

    // HTML code
    <video id="myVideo" ...>
    </video>
    
    // JavaScript code
    var options = {};
    options.mediaTransportType = "WIDEVINE";
    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 properties of the mediaOption parameter.

Property

Required

Data Type

Description

mediaTransportType

Optional

string

Code of Media Transport Types.

The player type is decided by this code. This property only requires when playing content used Widevine DRM. For other streaming protocols, 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.

  • "widevine"

  • "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.drm.widevine

Optional

object

The object that holds information of the Widevine DRM type.

option.drm.widevine.seperatedStream

Required

boolean

The flag that sets whether audio streaming data is separated with video streaming data. The default value is false.

  • true: Separated streaming

  • false: Integrated streaming

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.apativeResolution

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)

Media Transport Types

The following table describes media transport types.

Media Transport Type

Description

URI

URI is a general playing type. This type plays the content of URI.

WIDEVINE

Plays contents of Widevine DRM type.

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

Navigation