mediaOption Parameter
How to Use mediaOption Parameter
-
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;
-
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 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.
|
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.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.
|
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.apativeResolution |
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) |
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 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:
|
3D Mode Types
The following table describes 3D Mode types.
3D Mode Type |
Description |
---|---|
2D |
This format displays content with the 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 the 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 to Frame packing type. However, 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 the 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 frame. |
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 frame. |