# Class: Player
WebSKD Player
Base Pixellot WebSDK Player player class from which you can create video player.
# Hierarchy
VideojsPlayer
↳
Player
# Implements
# Table of contents
# Constructors
# Properties
# Accessors
- autoplay
- config
- controls
- currentTime
- duration
- element
- isFullscreen
- isLive
- isMuted
- isPaused
- mode
- poster
- rootElement
- src
- userActive
- videoElement
- videoHeight
- videoWidth
- volume
# Methods
# Constructors
# constructor
• new Player(element
, options?
)
Pixellot Player
const { SDKApi, Player } = window.PixellotWebSDK;
SDKApi.projectId('test');
const el = document.querySelector("#testVideo");
const brushWrapper = document.querySelector("#brush-wrapper");
const player = new Player(el, { autoplay: true });
# Parameters
Name | Type |
---|---|
element | HTMLElement |
options | PixellotPlayerOptions |
# Overrides
VideojsPlayer.constructor
# Properties
# ads
• ads: PlayerAds
# Implementation of
# Inherited from
VideojsPlayer.ads
# analytics
• analytics: PlayerAnalytics
# Implementation of
# Inherited from
VideojsPlayer.analytics
# pano
• pano: PlayerPano
# Implementation of
# recorder
• recorder: PlayerRecorder
# Implementation of
# thumbnails
• thumbnails: PlayerThumbnails
# Implementation of
# ui
• ui: PlayerUI
# Implementation of
# vdjsPlayer
• vdjsPlayer: any
# Implementation of
# Inherited from
VideojsPlayer.vdjsPlayer
# Accessors
# autoplay
• get
autoplay(): boolean
Gets or sets autoplay for player
player.autoplay = true // sets player into autoplay mode
# Returns
boolean
• set
autoplay(autoplay
): void
Gets or sets autoplay for player
player.autoplay = true // sets player into autoplay mode
# Parameters
Name | Type |
---|---|
autoplay | boolean |
# Returns
void
# config
• get
config(): PixellotPlayerConfig
# Returns
# Implementation of
• set
config(options
): void
# Parameters
Name | Type |
---|---|
options | PixellotPlayerConfigUpdate |
# Returns
void
# Implementation of
# controls
• get
controls(): boolean
Gets or sets showing player controls
- The state of showing controls
// get
const isControlsShown = player.controls;
// set
player.controls = false; // Hide player controls
# Returns
boolean
• set
controls(controls
): void
Gets or sets showing player controls
- The state of showing controls
// get
const isControlsShown = player.controls;
// set
player.controls = false; // Hide player controls
# Parameters
Name | Type |
---|---|
controls | boolean |
# Returns
void
# currentTime
• get
currentTime(): number
Gets or sets the current time (in seconds)
# Returns
number
• set
currentTime(time
): void
Gets or sets the current time (in seconds)
# Parameters
Name | Type |
---|---|
time | number |
# Returns
void
# duration
• get
duration(): number
Returns video duration Normally gets the length in time of the video in seconds;
The duration of the video in seconds
player.duration; // prints current video duration.
# Returns
number
# element
• get
element(): HTMLElement
# Returns
HTMLElement
# isFullscreen
• get
isFullscreen(): boolean
Check if the player is in fullscreen mode or not
- false: if not in fullscreen mode
- true: if in fullscreen mode
const isFullscreen = player.isFullscreen;
# Returns
boolean
# isLive
• get
isLive(): boolean
Returns boolean value if player video is in live mode or not
const isLive = player.isLive();
# Returns
boolean
# isMuted
• get
isMuted(): boolean
Check if the player's audio is in muted or not
- false: if audio is not muted
- true: if audio is muted
const isMuted = player.isMuted;
# Returns
boolean
# isPaused
• get
isPaused(): boolean
Check if the player is paused or has yet to play
- false: if the media is currently playing
- true: if media is not currently playing
const isPaused = player.isPaused(); // boolean
# Returns
boolean
# mode
• get
mode(): PlayerMode
# Returns
• set
mode(mode
): void
# Parameters
Name | Type |
---|---|
mode | PlayerMode |
# Returns
void
# poster
• get
poster(): string
Gets or sets the poster image source url
# Returns
string
• set
poster(poster
): void
Gets or sets the poster image source url
# Parameters
Name | Type |
---|---|
poster | string |
# Returns
void
# rootElement
• get
rootElement(): HTMLElement
# Returns
HTMLElement
# src
• get
src(): PlayerSrc
Get or set the video source. This method will set source explicitly to the video tag, so you may miss some of our features related to pano for eg.
# Returns
• set
src(src
): void
Get or set the video source. This method will set source explicitly to the video tag, so you may miss some of our features related to pano for eg.
# Parameters
Name | Type |
---|---|
src | PlayerSrc |
# Returns
void
# userActive
• get
userActive(): boolean
# Returns
boolean
• set
userActive(state
): void
# Parameters
Name | Type |
---|---|
state | boolean |
# Returns
void
# videoElement
• get
videoElement(): null
| HTMLVideoElement
# Returns
null
| HTMLVideoElement
# videoHeight
• get
videoHeight(): number
# Returns
number
# videoWidth
• get
videoWidth(): number
# Returns
number
# volume
• get
volume(): number
Gets or sets current volume of the media
- The current volume as a percent when getting
// get
const currentVolume = player.volume;
// set
player.volume = 0.5; // Set volume to half
# Returns
number
• set
volume(volume
): void
Gets or sets current volume of the media
- The current volume as a percent when getting
// get
const currentVolume = player.volume;
// set
player.volume = 0.5; // Set volume to half
# Parameters
Name | Type |
---|---|
volume | number |
# Returns
void
# Methods
# destroy
▸ destroy(): void
Destroys the video player and does any necessary cleanup
player.destroy();
# Returns
void
# Implementation of
# Inherited from
VideojsPlayer.destroy
# emit
▸ emit(eventName
, args
): void
# Parameters
Name | Type |
---|---|
eventName | string |
args | any |
# Returns
void
# Implementation of
# off
▸ off(eventName
, callback
): void
# Parameters
Name | Type |
---|---|
eventName | string |
callback | any |
# Returns
void
# Implementation of
# on
▸ on(eventName
, callback
): void
# Parameters
Name | Type |
---|---|
eventName | string |
callback | any |
# Returns
void
# Implementation of
# once
▸ once(eventName
, callback
): void
# Parameters
Name | Type |
---|---|
eventName | string |
callback | any |
# Returns
void
# Implementation of
# pause
▸ pause(): void
Pauses video playback
player.pause();
# Returns
void
# Implementation of
# Inherited from
VideojsPlayer.pause
# play
▸ play(): void
Starts playing video playback
player.play();
# Returns
void
# Implementation of
# Inherited from
VideojsPlayer.play
# setSrc
▸ setSrc(src
, mode?
): void
Set video source(s) to the player
# Parameters
Name | Type | Description |
---|---|---|
src | string | PlayerSource | The player video source(s) |
mode? | PlayerMode | Player mode. 'hd' by default player.setSrc('https://cdn.theoplayer.com/video/big_buck_bunny/big_buck_bunny.m3u8'); // or set both hd and pano // pano in the end will set player to the pano source from beginning player.setSrc({ hd: '/hd-source.mp4', pano: '/pano-source.m3u8' }, 'pano'); |
# Returns
void
# Implementation of
# stop
▸ stop(): void
Stops media playback and resets player
player.stop();
# Returns
void
# Implementation of
# Inherited from
VideojsPlayer.stop