mediaOption Parameter

How to Use mediaOption Parameter

  1. Create an object for mediaOption and set the 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 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 video element or audio element.

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

mediaOption Reference

The following table describes properties of mediaOption parameter.

Property

Required

Data Type

Description

mediaTransportType

Optional

string

Code of Media Transport Types.

Player type will be decided by this code. This property only requires when playing content used Widevine DRM. For other streaming protocol, this property will be set automatically. For more details, See Media Transport Types. Default value is URI.

option

Optional

object

Object that holds additional information for each media transport types.

option.mediaFormat

Optional

object

Object that holds information of media format.

option.mediaFormat.type

Optional

string

String that sets media type. 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"
  • "verimatrix"

option.drm.clientId

Optional

string

Client ID which was sent to app from DRM service. Set this property only when client ID exists that DRM service sent.

option.drm.widevine

Optional

object

Object that holds information of Widevine DRM type.

option.drm.widevine.seperatedStream

Required

boolean

Flag that sets whether audio streaming data is separated with video streaming data. Default value is false.

  • true: Separated streaming
  • false: Integrated streaming

option.transmission

Optional

object

Object that holds information of media content which is specific by server type and transmission protocol. This object will be sent to media pipeline.

option.transmission.dlnaInfo

Optional

object

Object that holds information for DLNA transport type. If you set the mediaTransportType to "DLNA", this object must be configured.

option.transmission.dlnaInfo.protocolInfo

Required

string

Information to send when HTTP connection makes.

option.transmission.dlnaInfo.contentLength

Required

number

Size of media content. The unit of content size is byte.

option.transmission.dlnaInfo.duration

Required

number

Play time of media content. The unit of play time is second. If there is no play time information in DLNA server, you must set this property.

option.transmission.dlnaInfo.opVal

Required

number

Value that related in seeking.

option.transmission.dlnaInfo.flagVal

Required

number

Flag value that related in seeking. This property only available for DTCPIP type content.

option.transmission.dlnaInfo.cleartextSize

Required

number

This property only available for DTCPIP type content.

option.transmission.playTime

Optional

object

Object that holds play time related parameter.

option.transmission.playTime.start

Optional

number

Start time (millisecond) for resuming media.

option.adaptiveStreaming

Optional

object

Object that holds information of network transmission status.

option.adaptiveStreaming.audioOnly

Optional

boolean

Flag that indicates streaming mode. This property can be used when transmit the audio only streaming (such as music service or radio service) with HLS protocol. Default value is false.

  • true: audio only
  • false: video/audio

option.adaptiveStreaming.apativeResolution

Optional

boolean

Flag that indicates whether screen ratio can be changed by network status. Default value is false.

  • true: changeable
  • false: unchangeable

option.adaptiveStreaming.seamlessPlay

Optional

boolean

Flag that whether content supports seamless play. Default value is false.

  • true: support seamless play
  • false: not support

option.adaptiveStreaming.maxWidth

Optional

number

Maximum screen width of content. Default value is 1920.

option.adaptiveStreaming.maxHeight

Optional

number

Maximum screen height of content. Default value is 1080.

option.adaptiveStreaming.bps

Optional

object

Object that holds information to control network transmit speed.

option.adaptiveStreaming.bps.start

Optional

number

Starting speed of network transmission. (bps)

option.3dMode

Optional

string

3D Mode Type (3D Mode Type).

Media Transport Types

The following table describes media transport types.

Media Transport Type

Description

URI

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

DLNA

Plays contents which are in DLNA server.

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

3D Mode Types

The following table describes 3D Mode types.

3D Mode Type

Description

2D

This format displays content with 2 Dimensional mode.

top_bottom

This format divides the screen lengthwise and puts two different frames for the left and right eyes top and down to create a single 3D frame image.

bottom_top

This format works in the same way as top_bottom, but positions of the top and bottom frames are switched.

side_by_side_LR

This format divides the screen widthwise and puts two different frames for the left and right eyes side by side to create a single 3D frame image.

side_by_side_RL

This format works in the same way as side_by_side_LR, but positions of the left and right frames are switched.

check_board

In this format, a 3D frame image is created by arranging the left and right eye frames in a mosaic pattern like a checkerboard.

frame-sequential

Left and right frames are sent alternately to the display and by diverse systems like shuttered glasses or polarized glasses are then shown to each eye.

column_interleave

This format interleaves the left and right eye views on every other vertical column in the display window

frame_packing

Frame Packing refers to the combination of two frames, one for the left eye and the other for the right eye, into a single “packed” frame that consists of these two individual sub-frames. The key difference of a Frame Packing signal is that each sub-frame for each eye is still at full resolution, i.e., 1920×1080 for a 1080p Frame Packing signal, and 1280×720 for 720p Frame Packing 3D content.

field_alternative

Field Alternative is similar with Frame packing type. But this type refers to the combination of more than 4 frames. This type breaks down each eye's frame to several field frames.

line_alternative

Line Alternative breaks down each eye's frame to line by line.

side_by_side_full_LR

This format encodes the screen framewise(L to R) and puts two different frames into each frame. for the left and right eyes side by side to create each frames.

side_by_side_full_RL

This format encodes the screen framewise(R to L) and puts two different frames into each frame. for the left and right eyes side by side to create each frames.

 

Navigation