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

API Reference

getVersion()

1
playerInstance.getVersion()
Copied!
This command returns OvenPlayer version information.

getConfig()

1
playerInstance.getConfig()
Copied!
This command returns the configured option value when OvenPlayer is initialized.
Request
Response
Type
Memo
null
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
1
{
2
autoStart: false
3
browser: {screen: "1440 x 900", browser: "Chrome", browserVersion: "73.0.3683.103", browserMajorVersion: 73, mobile: false, …}
4
controls: true
5
loop: false
6
mediaContainer: div.ovp-media-element-container
7
mute: false
8
playbackRate: 0.5
9
playbackRates: [0.25, 0.5, 1, 1.5, 2]
10
playlist: [{…}, {…}]
11
timecode: true
12
volume: 100
13
}
Copied!

load()

1
playerInstance.load(playlist)
Copied!
This command initializes OvenPlayer with a new playlist.
Request
Response
Type
Memo
Array
playlist or sources
example
1
playlist = [
2
{
3
title : "01",
4
adTagUrl : "https://pubads.g.doubleclick.net/gampad/ads?...",
5
image : "https://path.to/your_video_thumbnail.jpeg",
6
duration : 7343,
7
sources: [ {
8
type : "mp4",
9
file : "https://path.to/your_video",
10
label : "360P"
11
}],
12
tracks: [{
13
kind : "captions",
14
file : "https://path.to/your_caption.vtt",
15
label : "KO vtt"
16
}]
17
},
18
{
19
title : "02",
20
adTagUrl : "https://pubads.g.doubleclick.net/gampad/ads?...",
21
image : "https://path.to/your_video_thumbnail2.jpeg",
22
duration : 8333,
23
sources: [ {
24
type : "mp4",
25
file : "https://path.to/your_video2",
26
label : "360P"
27
},
28
{
29
type : "mpd",
30
file : "https://path.to/your_video.mpd",
31
label: "360P DASH"
32
}
33
tracks: [{
34
kind : "captions",
35
file : "https://path.to/your_caption2.vtt",
36
label : "KO vtt"
37
}]
38
}
39
];
40
41
or
42
43
sources = [
44
{
45
type : "mp4",
46
file : "https://path.to/your_video",
47
framerate : 30,
48
label : "360P"
49
},
50
{
51
type : "mp4",
52
file : "https://path.to/your_video",
53
framerate : 30,
54
label: "480P"
55
},
56
57
{
58
type : "mp4",
59
file : "https://path.to/your_video",
60
framerate : 30,
61
label : "720p",
62
default : "true"
63
}
64
];
Copied!
1
null
Copied!

getState()

1
playerInstance.getState()
Copied!
This command gets information about what OvenPlayer is currently doing.
Request
Response
Type
Memo
null
Type
Memo
String
"idle", "paused", "playing", "error", "loading", "complete", "adLoaded", "adPlaying", "adPaused", "adComplete"

getBrowser()

1
playerInstance.getBrowser()
Copied!
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
Type
Memo
null
Type
Memo
Object
User Agent Information
example
1
{
2
browser: "Chrome",
3
browserMajorVersion: 73,
4
browserVersion: "73.0.3683.103",
5
cookies: true,
6
flashVersion: "no check",
7
mobile: false,
8
os: "Mac OS X",
9
osVersion: "10_14_0",
10
screen: "1440 x 900",
11
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",
12
webview: false
13
}
Copied!

setTimecodeMode()

1
playerInstance.setTimecodeMode(isShow)
Copied!
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
Type
Memo
Boolean
Type
Memo
null

isTimecodeMode()

1
playerInstance.isTimecodeMode()
Copied!
This command checks whether OvenPlayer is currently running in time-code or frame-code.
Request
Response
Type
Memo
null
Type
Memo
Boolean
true : timecode, false : frame

getFramerate()

1
playerInstance.getFramerate()
Copied!
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
Type
Memo
null
Type
Memo
Number

seekFrame()

1
playerInstance.seekFrame(frameCount)
Copied!
This command moves the playback to frameCount.
Request
Response
Type
Memo
Number
frameCount to move
Type
Memo
Number
Moved frameCount

getDuration()

1
playerInstance.getDuration()
Copied!
This command gets the duration of the content.
Request
Response
Type
Memo
null
Type
Memo
Number
In live-broadcast, mark as Infinity

getPosition()

1
playerInstance.getPosition()
Copied!
This command gets the current playing time of content.
Request
Response
Type
Memo
null
Type
Memo
Number

getVolume()

1
playerInstance.getVolume()
Copied!
This command gets the volume value set in OvenPlayer.
Request
Response
Type
Memo
null
Type
Memo
Number
0 ~ 100

setVolume()

1
playerInstance.setVolume(volume)
Copied!
You can use this command to control volume in OvenPlayer.
Request
Response
Type
Memo
Number
0 ~ 100
Type
Memo
null

getMute()

1
playerInstance.getMute()
Copied!
This command gets if OvenPlayer is currently muted (or volume: 0).
Request
Response
Type
Memo
null
Type
Memo
Boolean

setMute()

1
playerInstance.setMute(isMute)
Copied!
You can use this command to set mute.
Request
Response
Type
Memo
Boolean
Type
Memo
Boolean
muted or not

play()

1
playerInstance.play()
Copied!
This command plays OvenPlayer.
If OvenPlayer is not ready to play, OvenPlayer will wait until it is prepared and then play.
Request
Response
Type
Memo
null
Type
Memo
null

pause()

1
playerInstance.pause()
Copied!
This command pauses the playing content.
Request
Response
Type
Memo
null
Type
Memo
null

seek()

1
playerInstance.seek(position)
Copied!
This command moves the playback to a position.
Request
Response
Type
Memo
Number
Seconds
Type
Memo
null

getPlaybackRate()

1
playerInstance.getPlaybackRate()
Copied!
This command gets the playback speed information of content.
Request
Response
Type
Memo
null
Type
Memo
Number

setPlaybackRate()

1
playerInstance.setPlaybackRate(playbackRate)
Copied!
You can use this command to adjust the playback speed in OvenPlayer.
Request
Response
Type
Memo
Number
Playback speed to change
Type
Memo
Number
Changed playback speed

getPlaylist()

1
playerInstance.getPlaylist()
Copied!
This command gets a registered playlist.
Request
Response
Type
Memo
null
Type
Memo
Array
example
1
[
2
{
3
title : "01",
4
adTagUrl : "https://pubads.g.doubleclick.net/gampad/ads?...",
5
image : "https://path.to/your_video_thumbnail.jpeg",
6
duration : 7343,
7
sources: [ {
8
type : "mp4",
9
file : "https://path.to/your_video",
10
label : "360P"
11
}],
12
tracks: [{
13
kind : "captions",
14
file : "https://path.to/your_caption.vtt",
15
label : "KO vtt"
16
}]
17
},
18
...
19
]
Copied!

getCurrentPlaylist()

1
playerInstance.getCurrentPlaylist()
Copied!
This command gets the index information of the playlist currently playing.
Request
Response
Type
Memo
null
Type
Memo
Number

setCurrentPlaylist()

1
playerInstance.setCurrentPlaylist(playlistIndex)
Copied!
This command changes the playlist currently playing.
Request
Response
Type
Memo
Number
Type
Memo
null

getSources()

1
playerInstance.getSources()
Copied!
This command gets information about sources from the playlist or sources of a single content currently playing.
Request
Response
Type
Memo
null
Type
Memo
Array
example
1
[{
2
file: "https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd",
3
index: 0,
4
label: "MPD test",
5
type: "dash"
6
}]
Copied!

getCurrentSource()

1
playerInstance.getCurrentSource()
Copied!
This command gets the index information of the currently playing source.
Request
Response
Type
Memo
null
Type
Memo
Number

setCurrentSource()

1
playerInstance.setCurrentSource(index)
Copied!
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
Type
Memo
Number
Type
Memo
Number
Configured source index

getQualityLevels()

1
playerInstance.getQualityLevels()
Copied!
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
Type
Memo
null
Type
Memo
Array
example
1
[
2
{
3
bitrate: 250000,
4
height: 180,
5
index: 0,
6
label: "320x180, 250.0kbps",
7
width: 320
8
},
9
...
10
]
Copied!

getCurrentQuality()

1
playerInstance.getCurrentQuality()
Copied!
This command gets the index of the current video quality information.
Request
Response
Type
Memo
null
Type
Memo
Number

setCurrentQuality()

1
playerInstance.setCurrentQuality(index)
Copied!
You can use this command to set to play as index quality.
Request
Response
Type
Memo
Number
Type
Memo
null

isAutoQuality()

1
playerInstance.isAutoQuality()
Copied!
This command checks whether the video quality has been set to change automatically based on internet status, condition, and more.
Request
Response
Type
Memo
null
Type
Memo
Boolean

setAutoQuality()

1
playerInstance.setAutoQulaity(isAuto)
Copied!
You can use this command to set whether to change the video quality automatically.
Request
Response
Type
Memo
Boolean
Type
Memo
null

getCaptionList()

1
playerInstance.getCaptionList()
Copied!
It reads the list of registered subtitles in the current playlist.
Request
Response
Type
Memo
null
Type
Memo
Array
1
[
2
{
3
data : [VTTCue],
4
file: captionUrl,
5
id: "captions0",
6
kind: "captions",
7
label: "KO vtt",
8
name: "KO vtt",
9
}
10
]
Copied!

getCurrentCaption()

1
playerInstance.getCurrentCaption()
Copied!
This command gets the index of the using subtitle in the current playlist.
Request
Response
Type
Memo
null
Type
Memo
Number

setCurrentCaption()

1
playerInstance.setCurrentCaption(index)
Copied!
You can use this command to set the subtitle of the current playlist to the caption of the index.
Request
Response
Type
Memo
Number
Type
Memo
null

addCaption()

1
playerInstance.addCaption(track)
Copied!
You can use this command to add subtitles to the current playlist.
Request
Response
Type
Memo
Object
1
{
2
kind: "captions",
3
file: captionUrl,
4
label: "KO vtt"
5
}
Copied!
Type
Memo

removeCaption()

1
playerInstance.removeCaption(index)
Copied!
You can use this command to remove the subtitle corresponding to the index from the current playlist.
Request
Response
Type
Memo
Number
Type
Memo
null

stop()

1
playerInstance.stop()
Copied!
This command stops playing and moves the playback position to 0.
Request
Response
Type
Memo
null
Type
Memo
null

showControls()

1
playerInstance.showControls(show)
Copied!
This API can show or hide the player's control area.
Request
Response
Type
Memo
Boolean
set true or false to show or hide controls
Type
Memo
null

remove()

1
playerInstance.stop()
Copied!
This command removes the player and releases all resources.

Architectures

Last modified 25d ago