API

This chapter lists information about the OvenPlayer API, which you can control with OvenPlayerInstance.

API Reference

getVersion()

playerInstance.getVersion()

This command returns OvenPlayer version information.

getConfig()

playerInstance.getConfig()

This command returns the configured option value when OvenPlayer is initialized.

Request
Response
Request

Type

Memo

null

Response

Attribute

Type

Memo

autoStart

Boolean

browser

Object

controls

Boolean

loop

Boolean

mediaContainer

DOMElement

mute

Boolean

playbackRate

Number

playbackRates

Array Of Numbers

playlist

Array Of playlist

timecode

Boolean

volume

Number

example
{
autoStart: false
browser: {screen: "1440 x 900", browser: "Chrome", browserVersion: "73.0.3683.103", browserMajorVersion: 73, mobile: false, …}
controls: true
loop: false
mediaContainer: div.ovp-media-element-container
mute: false
playbackRate: 0.5
playbackRates: [0.25, 0.5, 1, 1.5, 2]
playlist: [{…}, {…}]
timecode: true
volume: 100
}

load()

playerInstance.load(playlist)

This command initializes OvenPlayer with a new playlist.

Request
Response
Request

Type

Memo

Array

playlist or sources

example
playlist = [
{
title : "01",
adTagUrl : "https://pubads.g.doubleclick.net/gampad/ads?...",
image : "https://path.to/your_video_thumbnail.jpeg",
duration : 7343,
sources: [ {
type : "mp4",
file : "https://path.to/your_video",
label : "360P"
}],
tracks: [{
kind : "captions",
file : "https://path.to/your_caption.vtt",
label : "KO vtt"
}]
},
{
title : "02",
adTagUrl : "https://pubads.g.doubleclick.net/gampad/ads?...",
image : "https://path.to/your_video_thumbnail2.jpeg",
duration : 8333,
sources: [ {
type : "mp4",
file : "https://path.to/your_video2",
label : "360P"
},
{
type : "mpd",
file : "https://path.to/your_video.mpd",
label: "360P DASH"
}
tracks: [{
kind : "captions",
file : "https://path.to/your_caption2.vtt",
label : "KO vtt"
}]
}
];
or
sources = [
{
type : "mp4",
file : "https://path.to/your_video",
framerate : 30,
label : "360P"
},
{
type : "mp4",
file : "https://path.to/your_video",
framerate : 30,
label: "480P"
},
{
type : "mp4",
file : "https://path.to/your_video",
framerate : 30,
label : "720p",
default : "true"
}
];
Response
null

getState()

playerInstance.getState()

This command gets information about what OvenPlayer is currently doing.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

String

"idle", "paused", "playing", "error", "loading", "complete", "adLoaded", "adPlaying", "adPaused", "adComplete"

getBrowser()

playerInstance.getBrowser()

This command returns the analyzed information from the user agent. However, this information is not necessarily correct because the user agent can hide or misleading information.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Object

User Agent Information

example
{
browser: "Chrome",
browserMajorVersion: 73,
browserVersion: "73.0.3683.103",
cookies: true,
flashVersion: "no check",
mobile: false,
os: "Mac OS X",
osVersion: "10_14_0",
screen: "1440 x 900",
ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36",
webview: false
}

setTimecodeMode()

playerInstance.setTimecodeMode(isShow)

You can use this command to set whether the time-code or frame-code is displayed in the OvenPlayer control bar. However, if you want to use frame-code, the source must contain frame rate information.

Request
Response
Request

Type

Memo

Boolean

Response

Type

Memo

null

isTimecodeMode()

playerInstance.isTimecodeMode()

This command checks whether OvenPlayer is currently running in time-code or frame-code.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Boolean

true : timecode, false : frame

getFramerate()

playerInstance.getFramerate()

This command gets the frame-rate value of playing video. However, if you want to see frame-rate, the source or playlist must have information about frame-rate.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Number

seekFrame()

playerInstance.seekFrame(frameCount)

This command moves the playback to frameCount.

Request
Response
Request

Type

Memo

Number

frameCount to move

Response

Type

Memo

Number

Moved frameCount

getDuration()

playerInstance.getDuration()

This command gets the duration of content.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Number

In live-broadcast, mark as Infinity

getPosition()

playerInstance.getPosition()

This command gets the current playing time of content.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Number

getVolume()

playerInstance.getVolume()

This command gets the volume value set in OvenPlayer.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Number

0 ~ 100

setVolume()

playerInstance.setVolume(volume)

You can use this command to control volume in OvenPlayer.

Request
Response
Request

Type

Memo

Number

0 ~ 100

Response

Type

Memo

null

getMute()

playerInstance.getMute()

This command gets if OvenPlayer is currently muted (or volume: 0).

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Boolean

setMute()

playerInstance.setMute(isMute)

You can use this command to set mute.

Request
Response
Request

Type

Memo

Boolean

Response

Type

Memo

Boolean

muted or not

play()

playerInstance.play()

This command plays OvenPlayer.

If OvenPlayer is not ready to play, OvenPlayer will wait until it is prepared and then play.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

null

pause()

playerInstance.pause()

This command pauses the playing content.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

null

seek()

playerInstance.seek(position)

This command moves the playback to a position.

Request
Response
Request

Type

Memo

Number

Seconds

Response

Type

Memo

null

getPlaybackRate()

playerInstance.getPlaybackRate()

This command gets the playback speed information of content.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Number

setPlaybackRate()

playerInstance.setPlaybackRate(playbackRate)

You can use this command to adjust the playback speed in OvenPlayer.

Request
Response
Request

Type

Memo

Number

Playback speed to change

Response

Type

Memo

Number

Changed playback speed

getPlaylist()

playerInstance.getPlaylist()

This command gets a registered playlist.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Array

example
[
{
title : "01",
adTagUrl : "https://pubads.g.doubleclick.net/gampad/ads?...",
image : "https://path.to/your_video_thumbnail.jpeg",
duration : 7343,
sources: [ {
type : "mp4",
file : "https://path.to/your_video",
label : "360P"
}],
tracks: [{
kind : "captions",
file : "https://path.to/your_caption.vtt",
label : "KO vtt"
}]
},
...
]

getCurrentPlaylist()

playerInstance.getCurrentPlaylist()

This command gets the index information of the playlist currently playing.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Number

setCurrentPlaylist()

playerInstance.setCurrentPlaylist(playlistIndex)

This command changes the playlist currently playing.

Request
Response
Request

Type

Memo

Number

Response

Type

Memo

null

getSources()

playerInstance.getSources()

This command gets information about sources from the playlist or sources of a single content currently playing.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Array

example
[{
file: "https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd",
index: 0,
label: "MPD test",
type: "dash"
}]

getCurrentSource()

playerInstance.getCurrentSource()

This command gets the index information of the currently playing source.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Number

setCurrentSource()

playerInstance.setCurrentSource(index)

This command changes the source of the playing content. It depends on your settings, but the protocol and video quality (resolution) will change by default.

Request
Response
Request

Type

Memo

Number

Response

Type

Memo

Number

Configured source index

getQualityLevels()

playerInstance.getQualityLevels()

This command gets a list of resolutions if the metadata in the playing content contains quality information. And it is available when using the MPEG-DASH protocol.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Array

example
[
{
bitrate: 250000,
height: 180,
index: 0,
label: "320x180, 250.0kbps",
width: 320
},
...
]

getCurrentQuality()

playerInstance.getCurrentQuality()

This command gets the index of the current video quality information.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Number

setCurrentQuality()

playerInstance.setCurrentQuality(index)

You can use this command to set to play as index quality.

Request
Response
Request

Type

Memo

Number

Response

Type

Memo

null

isAutoQuality()

playerInstance.isAutoQuality()

This command checks to see if the video quality has set to change automatically based on internet status, condition, and more.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Boolean

setAutoQuality()

playerInstance.setAutoQulaity(isAuto)

You can use this command to set whether to change the video quality automatically.

Request
Response
Request

Type

Memo

Boolean

Response

Type

Memo

null

getCaptionList()

playerInstance.getCaptionList()

현재 플레이리스트의 등록된 자막 목록을 읽어옵니다.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Array

[
{
data : [VTTCue],
file: captionUrl,
id: "captions0",
kind: "captions",
label: "KO vtt",
name: "KO vtt",
}
]

getCurrentCaption()

playerInstance.getCurrentCaption()

This command gets the index of the using subtitle in the current playlist.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

Number

setCurrentCaption()

playerInstance.setCurrentCaption(index)

You can use this command to set the subtitle of the current playlist to the caption of the index.

Request
Response
Request

Type

Memo

Number

Response

Type

Memo

null

addCaption()

playerInstance.addCaption(track)

You can use this command to add subtitle in the current playlist.

Request
Response
Request

Type

Memo

Object

{
kind: "captions",
file: captionUrl,
label: "KO vtt"
}
Response

Type

Memo

removeCaption()

playerInstance.removeCaption(index)

You can use this command to remove the subtitle corresponding to the index from the current playlist.

Request
Response
Request

Type

Memo

Number

Response

Type

Memo

null

stop()

playerInstance.stop()

This command stops playing and moves the playback position to 0.

Request
Response
Request

Type

Memo

null

Response

Type

Memo

null

Architectures