Class: Controller
VXDK Controller class that exposes all public APIs for video playback control
Properties
hook
hook:
Hook
<Controller
>
Hook for extending controller functionality
Defined in
modules/context/controller.ts:18 (opens in a new tab)
Accessors
emit
get
emit(): (name
,data
?) =>void
Emits an event
Returns
Function
The function to emit an event
Parameters
• name: string
| number
• data?: undefined
Returns
void
Defined in
modules/context/controller.ts:169 (opens in a new tab)
off
get
off(): (name
,listener
) =>void
Removes an event listener
Returns
Function
The function to remove the event listener
Parameters
• name: string
| number
• listener: Listener
<void
>
Returns
void
Defined in
modules/context/controller.ts:153 (opens in a new tab)
on
get
on(): (name
,listener
) =>Disposable
Binds an event listener
Returns
Function
The bound event listener function
Parameters
• name: string
| number
• listener: Listener
<void
>
Returns
Defined in
modules/context/controller.ts:145 (opens in a new tab)
once
get
once(): (name
,listener
) =>void
Binds a one-time event listener
Returns
Function
The bound one-time event listener function
Parameters
• name: string
| number
• listener: Listener
<void
>
Returns
void
Defined in
modules/context/controller.ts:161 (opens in a new tab)
Methods
destroy()
destroy():
void
Destroys the player instance and releases resources
Returns
void
Defined in
modules/context/controller.ts:427 (opens in a new tab)
enterFullscreen()
enterFullscreen():
void
Enters fullscreen mode
Returns
void
Throws
If the fullscreen API is not supported or permission is denied
Defined in
modules/context/controller.ts:329 (opens in a new tab)
enterPip()
enterPip():
Promise
<void
>
Enters picture-in-picture mode
Returns
Promise
<void
>
Defined in
modules/context/controller.ts:354 (opens in a new tab)
exitFullscreen()
exitFullscreen():
void
Exits fullscreen mode
Returns
void
Throws
If the fullscreen API is not supported or the document is not in fullscreen mode
Defined in
modules/context/controller.ts:336 (opens in a new tab)
exitPip()
exitPip():
Promise
<void
>
Exits picture-in-picture mode
Returns
Promise
<void
>
Defined in
modules/context/controller.ts:359 (opens in a new tab)
getAutoPlay()
getAutoPlay():
boolean
Checks if autoplay is enabled
Returns
boolean
true if autoplay is enabled, false otherwise
Defined in
modules/context/controller.ts:193 (opens in a new tab)
getBufferedPercentage()
getBufferedPercentage():
number
Gets the percentage of the video that has been buffered
Returns
number
The buffered percentage (0-100)
Defined in
modules/context/controller.ts:309 (opens in a new tab)
getContext()
getContext():
Context
Gets the context of the player
Returns
The context object
Defined in
modules/context/controller.ts:422 (opens in a new tab)
getCurrentLevel()
getCurrentLevel():
Level
Gets the current quality level
Returns
The current quality level
Defined in
modules/context/controller.ts:284 (opens in a new tab)
getCurrentTime()
getCurrentTime():
number
Gets the current playback time
Returns
number
The current time in seconds
Defined in
modules/context/controller.ts:290 (opens in a new tab)
getDuration()
getDuration():
number
Gets the total duration of the video
Returns
number
The duration in seconds
Defined in
modules/context/controller.ts:278 (opens in a new tab)
getHeight()
getHeight():
number
Gets the current height of the player
Returns
number
The height of the player in pixels
Defined in
modules/context/controller.ts:387 (opens in a new tab)
getLevels()
getLevels():
Level
[]
Gets the available quality levels
Returns
Level
[]
An array of available quality levels
Defined in
modules/context/controller.ts:303 (opens in a new tab)
getOptions()
getOptions():
Options
Retrieves the current options from the context.
Returns
The current options object.
Defined in
modules/context/controller.ts:416 (opens in a new tab)
getPlaybackAdapter()
getPlaybackAdapter():
Playback
<any
>
Gets the playback adapter
Returns
Playback
<any
>
The playback adapter instance
Defined in
modules/context/controller.ts:273 (opens in a new tab)
getPlaybackRate()
getPlaybackRate():
number
Gets the current playback rate
Returns
number
The current playback rate
Defined in
modules/context/controller.ts:256 (opens in a new tab)
getPlaybackType()
getPlaybackType():
PlaybackType
Gets the current playback type
Returns
The playback type
Defined in
modules/context/controller.ts:264 (opens in a new tab)
getPlugin()
getPlugin<
T
>(plugin
):T
Retrieves a plugin instance of the specified type.
Type Parameters
• T extends Plugin
<any
>
The type of the plugin that extends the Plugin
base class.
Parameters
• plugin: ModuleClass
<T
>
The class of the plugin to retrieve.
Returns
T
The plugin instance of the specified type.
Defined in
modules/context/controller.ts:396 (opens in a new tab)
getPluginByName()
getPluginByName<
T
>(name
):T
Retrieves a plugin instance by its name.
Type Parameters
• T extends Plugin
<any
>
The type of the plugin that extends the Plugin
base class.
Parameters
• name: string
The name of the plugin to retrieve.
Returns
T
The plugin instance of the specified type.
Defined in
modules/context/controller.ts:407 (opens in a new tab)
getRootElement()
getRootElement():
HTMLElement
Gets the root element of the player
Returns
HTMLElement
The root HTMLElement of the player
Defined in
modules/context/controller.ts:375 (opens in a new tab)
getState()
getState():
State
Gets the current state of the player
Returns
The current state object
Defined in
modules/context/controller.ts:316 (opens in a new tab)
getVersion()
getVersion():
string
Retrieves the current version of the video player.
Returns
string
The version string of the video player.
Defined in
modules/context/controller.ts:102 (opens in a new tab)
getVolume()
getVolume():
number
Gets the current volume level
Returns
number
The current volume level (0-1)
Defined in
modules/context/controller.ts:187 (opens in a new tab)
getWidth()
getWidth():
number
Gets the current width of the player
Returns
number
The width of the player in pixels
Defined in
modules/context/controller.ts:381 (opens in a new tab)
isAutoLevelEnabled()
isAutoLevelEnabled():
boolean
Checks if auto-level selection is enabled
Returns
boolean
true if auto-level is enabled, false otherwise
Defined in
modules/context/controller.ts:296 (opens in a new tab)
isFullscreen()
isFullscreen():
boolean
Checks if the player is in fullscreen mode
Returns
boolean
true if in fullscreen, false otherwise
Defined in
modules/context/controller.ts:342 (opens in a new tab)
isLive()
isLive():
boolean
Checks if the current playback is a live stream
Returns
boolean
true if live, false otherwise
Defined in
modules/context/controller.ts:322 (opens in a new tab)
isMuted()
isMuted():
boolean
Checks if the playback is currently muted
Returns
boolean
true if muted, false otherwise
Defined in
modules/context/controller.ts:211 (opens in a new tab)
isPip()
isPip():
boolean
Checks if the player is in picture-in-picture mode
Returns
boolean
true if in PiP mode, false otherwise
Defined in
modules/context/controller.ts:365 (opens in a new tab)
isPlaying()
isPlaying():
boolean
Checks if the video is currently playing.
Returns
boolean
true
if the video is currently playing, otherwise false
.
Defined in
modules/context/controller.ts:93 (opens in a new tab)
load()
load():
void
Loads the video source into the playback system.
This method initializes the playback by loading the video from the start time specified in the context.
Returns
void
Defined in
modules/context/controller.ts:43 (opens in a new tab)
mute()
mute():
void
Mutes the playback
Returns
void
Defined in
modules/context/controller.ts:215 (opens in a new tab)
pause()
pause():
void
Pauses video playback.
This method stops the video from playing but retains the current playback position.
Returns
void
Defined in
modules/context/controller.ts:109 (opens in a new tab)
play()
play():
void
|Promise
<void
>
Starts or resumes video playback. A promise that resolves when playback starts, or void if synchronous.
Returns
void
| Promise
<void
>
Defined in
modules/context/controller.ts:60 (opens in a new tab)
replay()
replay():
void
|Promise
<void
>
Replays the video from the beginning.
This method resets the playback to the start and begins playing the video from the beginning.
Returns
void
| Promise
<void
>
A promise that resolves when playback starts, or void if synchronous.
Defined in
modules/context/controller.ts:84 (opens in a new tab)
seekTo()
seekTo(
time
):void
Seeks to a specific time in the video.
Parameters
• time: number
The time position to seek to, in seconds.
Returns
void
Defined in
modules/context/controller.ts:127 (opens in a new tab)
seekToPercentage()
seekToPercentage(
percentage
):void
Seeks to a specific percentage of the video's total duration.
Parameters
• percentage: number
The percentage of the video duration to seek to (value between 0 and 100).
Returns
void
Defined in
modules/context/controller.ts:136 (opens in a new tab)
selectAudioLanguage()
selectAudioLanguage(
language
):void
Selects the audio language for playback
Parameters
• language: string
The language code to select
Returns
void
Defined in
modules/context/controller.ts:240 (opens in a new tab)
setLevel()
setLevel(
level
):void
Sets the quality level for playback
Parameters
• level: "auto"
| Level
The quality level to set, or 'auto' for automatic
Returns
void
Defined in
modules/context/controller.ts:232 (opens in a new tab)
setPlaybackRate()
setPlaybackRate(
playbackRate
):void
Sets the playback rate
Parameters
• playbackRate: number
The playback rate (e.g., 1.0 for normal speed)
Returns
void
Defined in
modules/context/controller.ts:248 (opens in a new tab)
setSource()
setSource(
src
):void
Sets the video source URL for playback.
Parameters
• src: string
The URL of the video source to be played.
Returns
void
Defined in
modules/context/controller.ts:52 (opens in a new tab)
setVolume()
setVolume(
volume
):void
Sets the volume of the playback
Parameters
• volume: number
The volume level (0-1)
Returns
void
Defined in
modules/context/controller.ts:177 (opens in a new tab)
stop()
stop():
void
Stops video playback entirely.
This method stops the video and resets the playback position to the start.
Returns
void
Defined in
modules/context/controller.ts:118 (opens in a new tab)
toggleFullscreen()
toggleFullscreen():
void
Toggles fullscreen mode
Returns
void
Defined in
modules/context/controller.ts:348 (opens in a new tab)
toggleMute()
toggleMute():
void
Toggles between muted and unmuted states
Returns
void
Defined in
modules/context/controller.ts:198 (opens in a new tab)
togglePip()
togglePip():
Promise
<void
>
Toggles picture-in-picture mode
Returns
Promise
<void
>
Defined in
modules/context/controller.ts:370 (opens in a new tab)
togglePlay()
togglePlay():
void
Toggles video playback between playing and paused states.
If the video is currently playing, it will be paused. If it is paused, playback will resume.
Returns
void
Defined in
modules/context/controller.ts:69 (opens in a new tab)
unmute()
unmute():
void
Unmutes the playback
Returns
void
Defined in
modules/context/controller.ts:220 (opens in a new tab)
create()
static
create(context
):Controller
Factory method to create a new instance of VxdkController.
Parameters
• context: Context
The context object containing playback options and configurations.
Returns
A new instance of the VxdkController.