# API Reference
After creating a bytearkPlayer instance, you can call its API methods directly.
Note
Because ByteArk Player is built on Video.js, all Video.js methods are also available. See the Video.js Player API (opens new window) for the full reference.
# Setup methods
| Method | Description |
|---|---|
player.dispose() | Stop the player and release its resources |
# Playback controller
| Method | Description |
|---|---|
player.play() | Start playback |
player.pause() | Pause playback |
player.paused() | Returns true if paused, false if playing |
# Media controller
# player.src(source)
Change the currently playing source.
Parameters
| Attribute | Description | Type |
|---|---|---|
| source | Source object used to play the video | Object |
# Audio
# player.volume(volume)
Get or set the playback volume.
Parameters
| Attribute | Description | Type |
|---|---|---|
| volume | Volume between 0 and 1 | Number |
Returns
| Description | Type |
|---|---|
| Current volume (0 - 1) | Number |
# player.muted(muted)
Get or set the muted state.
Parameters
| Attribute | Description | Type |
|---|---|---|
| muted | true to mute, false to unmute | Boolean |
Returns
| Description | Type |
|---|---|
true if muted, false if not | Boolean |
# Tracks & quality
# player.qualityLevels()
Returns the list of available quality levels for the current video.
Returns
| Description | Type |
|---|---|
| Array of Quality Objects | Array |
Quality Object
| Name | Type | Description |
|---|---|---|
| name | String | Quality name, e.g. 720p, 480p |
| level | Number | Quality index |
| url | Array | List of quality URLs |
# player.qualityLevel(level)
Get or set the quality level for the current video.
Parameters
| Attribute | Description | Type |
|---|---|---|
| level | Quality index to set | Number |
Returns
| Name | Type | Description |
|---|---|---|
| name | String | Quality name |
| level | Number | Quality index |
| url | Array | List of quality URLs |
# player.hasQualityLevels()
Returns true if the current video has multiple quality levels, false otherwise.
# Playback speed
# player.playbackRate(rate)
Get or set the playback rate.
Parameters
| Attribute | Description | Type |
|---|---|---|
| rate | Playback rate (normal is 1.0) | Number |
Returns
| Description | Type |
|---|---|
| Current playback rate | Number |
# Time & status
# player.duration()
Get the duration of the current video.
Returns
| Media Type | Description | Type |
|---|---|---|
| VOD | Duration in seconds | Number |
| Live | Infinity for live streams | Number |
# player.currentTime(seconds)
Get or set the current playback position.
Parameters
| Attribute | Description | Type |
|---|---|---|
| seconds | Desired position in seconds | Number |
Returns
| Description | Type |
|---|---|
| Current position in seconds | Number |
# player.error()
Get the current Error object from the player.
Returns
| Name | Type | Description |
|---|---|---|
| code | Number | Error code |
| message | String | Error description |