mediaOption Parameters
How to use mediaoption parameters
- 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; - Convert the created object to JSON string and encode it.
var mediaOption = encodeURI(JSON.stringify(options)); - Create the source element.
var source = document.createElement("source"); - Add attributes to the created source element for media content.
var dataURL = "quot;http://example.com/test.mp4"; source.setAttribute('src', dataURL); - Add the escaped string to type attribute as below:
source.setAttribute('type', 'video/mp4;mediaOption=' + mediaOption); - 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.
| Parameter | Required | Data Type | Description |
|---|---|---|---|
| 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.
|
| option.drm | Optional | object | Object that holds DRM information. |
| option.drm.type | Optional | string | Type of DRM.
|
| 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.
|
| option.adaptiveStreaming.adaptiveResolution | Optional | boolean | The flag that indicates whether screen ratio can be changed by network status. The default value is false.
|
| option.adaptiveStreaming.seamlessPlay | Optional | boolean | Flag whether content supports seamless play. The default value is false.
|
| 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 Type | Description |
|---|---|
| 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:
|
No Headings