Skip to content

Latest commit

 

History

History
3541 lines (2360 loc) · 63.6 KB

api.md

File metadata and controls

3541 lines (2360 loc) · 63.6 KB

Table of Contents

KPAdObject

Type: Object

Properties

  • url Array<string> List of urls, each one specifies the ad tag url that is requested from the ad server. The player will request the first url, if failed, it will request the second url and so on (aka waterfalling).
  • response Array<string> List of XMLs, each one specifies a VAST 2.0 document to be used as the ads response instead of making a request via an ad tag url. The player will use the first XML, if failed, it will use the second and so on (aka waterfalling).
  • bumper boolean Specifies whether this is a bumper.
  • prebid KPAdPrebidConfig Specifies whether this is a prebid ad and add the relevant config for prebid request.

KPAdPod

Type: Array<KPAdObject>

KPAdBreakObject

Type: Object

Properties

  • position number The position, in seconds, to show the ad break.
  • percentage number Alternative parameter to position. The position, in percentage of the media length, to show the ad break (optional).
  • every number Alternative parameter to position. Play ad break every X seconds (optional).
  • ads KPAdPod An array of ads to play (Ad pod).

KPAdvertisingConfigObject

Type: Object

Properties

  • prebid KPPrebidConfig The prebid config.
  • adBreaks Array<KPAdBreakObject> The ad breaks scheme.
  • playAdsAfterTime number? Only play ad breaks scheduled after this time (in seconds). This setting is strictly after - e.g. setting playAdsAfterTime to 15 will cause the player to ignore an ad break scheduled to play at 15s.
  • showAdBreakCuePoint boolean? Whether to show the ad breaks cue points.
  • adBreakCuePointStyle Object? Style options for the ad breaks cue points - See the options Here.

KalturaPlayers

a map of player instances by player ids

Type: Object<string, KalturaPlayer>

HEVCConfigObject

Type: Object

Properties

  • width number Optional width of the video
  • height number Optional height of the video
  • bitrate number Optional number of bits used to encode a second of video
  • framerate number Optional number of frames used in one second

HEVCSupportedObject

Type: Object

Properties

  • isHEVCSupported number Specifies HEVC supported option by the browser
  • isPowerEfficient number Specifies power efficiency supported option

DRMSupportedObject

Type: Object

Properties

  • isDRMSupported number Specifies DRM supported option by the browser
  • supportedDRMs Array<string> List of supported DRMs (optional values: widevine, playready, fairplay)

MediaCapabilitiesObject

Type: Object

SupportedOptionsType

Type: Object<string, number>

KPMediaConfig

Type: Object

Properties

  • sources ProviderMediaConfigSourcesObject
  • session ProviderMediaConfigSessionObject

KPPlaylistOptions

Type: Object

Properties

  • autoContinue boolean? Determines whether to continue to the next item automatically.
  • loop boolean? Determines whether to play the playlist in a loop. When selected, the playlist will play automatically even if autoContinue is set to false.

KPPlaylistCountdownOptions

Type: Object

Properties

  • timeToShow number? Shows when the countdown is scheduled to appear (by default, this is towards the end).
  • duration number? Shows for how long the countdown will appear.
  • showing boolean? Determines whether to show the countdown.

KPPlaylistConfigObject

Type: Object

Properties

KPPlaylistObject

Type: Object

Properties

KPPlaylistItemConfigObject

Type: Object

Properties

KPPluginsConfigObject

Type: Object

AdBreak

Parameters

  • options PKAdBreakOptions Ad break data options.

type

Type: string?

Returns string Ad break type - pre/mid/post.

position

Type: number?

Returns string Ad break position on the playback timeline.

numAds

Type: number?

Returns string The number of ads inside the ad break.

Ad

Parameters

  • id string Ad ID.
  • options PKAdOptions Ad data options.

id

Type: string

Returns string Ad ID.

system

Type: string?

Returns string? Ad system.

contentType

Type: string?

Returns string Ad content type.

url

Type: string?

Returns string Ad URL.

title

Type: string?

Returns string Ad title.

position

Type: number?

Returns string Ad position inside the ad break.

duration

Type: number?

Returns string Ad duration.

clickThroughUrl

Type: string?

Returns string Ad click through URL.

posterUrl

Type: string?

Returns string Ad poster URL.

skipOffset

Type: number?

Returns string Ad skip offset.

linear

Type: boolean

Returns boolean Whether the ad is linear.

width

Type: number

Returns string Ad width.

height

Type: number

Returns string Ad height.

bitrate

Type: number

Returns string Ad bitrate.

bumper

Type: boolean

Returns boolean Whether the ad is bumper.

inStream

Type: boolean

Returns boolean Whether the ad is imadai.

skippable

Type: boolean

Returns string Whether the ad is skippable or not.

vpaid

Type: boolean

Returns boolean Whether the ad is vpaid or not.

streamId

Type: string

Returns string The ad streamId.

wrapperAdIds

Type: Array<string>

Returns string The ad wrapperAdIds.

wrapperCreativeIds

Type: Array<string>

Returns string The ad wrapperCreativeIds.

wrapperAdSystems

Type: Array<string>

Returns string The ad wrapperAdSystems.

PrebidManager

Manager for prebid lib.

Parameters

load

load the prebid

Parameters

  • config KPAdPrebidConfig The prebid config.

Returns void

BaseRemotePlayer

Extends FakeEventTarget

Basic remote player. Implements the Kaltura Player playback, ads, tracks,vr and cast APIs. Remote players should extend this class and implement the needed API.

Parameters

loadMedia

Loads a media to the receiver application.

Parameters

  • mediaInfo Object The entry media info.

Returns Promise<void> Promise to indicate load succeed or failed.

setMedia

Sets a media to the remote player..

Parameters

  • mediaConfig Object Media configuration to set.

Returns void

getMediaInfo

Gets the media Info.

Returns Object? The media info.

getMediaConfig

Gets the media config.

Returns Object? The media config.

configure

Configure the remote player

Parameters

  • config Object Configuration to set. (optional, default {})

Returns void

ready

The remote player readiness.

Returns Promise<any> Promise which resolved when the remote player is ready.

load

Load the remote player.

Returns void

play

Play/resume the remote player.

Returns void

pause

Pause the remote player.

Returns void

reset

Reset the remote player.

Returns void

destroy

Destroy the remote player.

Returns void

isLive

Examples

BaseRemotePlayer.prototype.isLive(); // false

Returns boolean Whether the current playback is a live playback.

isDvr

Examples

BaseRemotePlayer.prototype.isDvr(); // false

Returns boolean Whether the current live playback has DVR window. In case of non-live playback will return false.

seekToLiveEdge

Seeks to the live edge.

Returns void

getStartTimeOfDvrWindow

Examples

BaseRemotePlayer.prototype.getStartTimeOfDvrWindow(); // 0

Returns number The start time of the DVR window.

getTracks

Parameters

Examples

BaseRemotePlayer.prototype.getTracks(); // []

Returns Array<Track> The remote player tracks.

getActiveTracks

Examples

BaseRemotePlayer.prototype.getTracks(); // {audio: undefined, video: undefined, text: undefined}

Returns Object The remote player active tracks.

selectTrack

Select a certain track to be active.

Parameters

  • track Track The track to activate.

Returns void

hideTextTrack

Hides the active text track.

Returns void

enableAdaptiveBitrate

Enables automatic adaptive bitrate switching.

Returns void

isAdaptiveBitrateEnabled

Examples

BaseRemotePlayer.prototype.isAdaptiveBitrateEnabled(); // true

Returns boolean Whether adaptive bitrate is enabled.

setTextDisplaySettings

Sets the text display settings.

Parameters

  • settings Object Text settings.

Returns void

startCasting

Start casting.

Returns Promise<any> A promise to indicate session is starting, or failed

stopCasting

Stops the current cast session.

Returns void

isCasting

Examples

BaseRemotePlayer.prototype.isCasting(); // true

Returns boolean Whether casting is currently active.

isCastAvailable

Examples

BaseRemotePlayer.prototype.isCastAvailable(); // true

Returns boolean Whether casting is available.

getCastSession

Gets the current remote session.

Examples

BaseRemotePlayer.prototype.getCastSession(); // new RemoteSession('', '')

Returns RemoteSession The remote session.

isVr

Examples

BaseRemotePlayer.prototype.isVr(); // false

Returns boolean Whether the current media is of VR type (360 content).

toggleVrStereoMode

Toggles VR mode on the current content.

Returns void

isInVrStereoMode

Examples

BaseRemotePlayer.prototype.isInVrStereoMode(); // false

Returns boolean Whether the current content displayed in VR mode.

ads

The remote player ads controller.

Type: Object?

Examples

BaseRemotePlayer.prototype.ads; // null

Returns Object?

textStyle

Setter.

Type: TextStyle

Parameters

  • style TextStyle The text style to set.

Returns void

textStyle

Getter.

Type: TextStyle

Examples

BaseRemotePlayer.prototype.textStyle; // new TextStyle()

Returns TextStyle The current text style.

buffered

Gets the first buffered range of the remote player.

Type: Array<any>

Examples

BaseRemotePlayer.prototype.buffered; // []

Returns Array<any> First buffered range in seconds.

currentTime

Setter.

Type: number

Parameters

  • to number The number to set in seconds.

Returns void

currentTime

Getter.

Type: number

Examples

BaseRemotePlayer.prototype.currentTime; // 0

Returns number The current time in seconds.

duration

Type: number

Examples

BaseRemotePlayer.prototype.duration; // 0

Returns number The duration in seconds.

liveDuration

Type: number

Examples

BaseRemotePlayer.prototype.liveDuration; // NaN

Returns number The live duration in seconds.

volume

Setter.

Type: number

Parameters

  • vol number The volume to set in the range of 0-1.

Returns void

volume

Getter.

Type: number

Examples

BaseRemotePlayer.prototype.volume; // 1

Returns number The current volume in the range of 0-1.

paused

Type: boolean

Examples

BaseRemotePlayer.prototype.paused; // false

Returns boolean Whether the cast player is in paused state.

ended

Type: boolean

Examples

BaseRemotePlayer.prototype.ended; // false

Returns boolean Whether the cast player is in ended state.

seeking

Type: boolean

Examples

BaseRemotePlayer.prototype.seeking; // false

Returns boolean Whether the cast player is in seeking state.

muted

Setter.

Type: boolean

Parameters

  • mute boolean The mute value to set.

Returns void

muted

Getter.

Type: boolean

Examples

BaseRemotePlayer.prototype.muted; // false

Returns boolean The muted state.

src

Type: string

Examples

BaseRemotePlayer.prototype.src; // ''

Returns string The current playing source url.

poster

Type: string

Examples

BaseRemotePlayer.prototype.poster; // ''

Returns string The current poster url.

playbackRate

Setter.

Type: number

Parameters

  • rate number The playback rate to set.

Returns void

playbackRate

Type: number

Examples

BaseRemotePlayer.prototype.playbackRate; // 1

Returns string The current playback rate.

engineType

Type: string

Examples

BaseRemotePlayer.prototype.engineType; // ''

Returns string The active engine type.

streamType

Type: string

Examples

BaseRemotePlayer.prototype.streamType; // ''

Returns string The active stream type.

type

Type: string

Examples

BaseRemotePlayer.prototype.type; // BaseRemotePlayer.Type

Returns string The remote player type.

config

Type: Object

Returns KPOptionsObject The runtime remote player config.

defaultConfig

Default configuration of the remote player.

Type: Object

Examples

BaseRemotePlayer.defaultConfig; // {}

Type

Remote player type.

Type: string

Examples

BaseRemotePlayer.Type; // 'BaseRemotePlayer'

isSupported

Examples

BaseRemotePlayer.isSupported(); // true

Returns boolean Whether the remote player is supported in the current environment.

CastEventType

Type: Object

Examples

// Events lifecycle
1. CAST_AVAILABLE
2. CAST_SESSION_STARTING
3. CAST_SESSION_STARTED || CAST_SESSION_START_FAILED -> X
4. CAST_SESSION_ENDING
5. CAST_SESSION_ENDED
// How to use
player.addEventListener(KalturaPlayer.cast.CastEventType.CAST_SESSION_STARTED, e => {
  console.log(e.session);
};

CAST_SESSION_START_FAILED

Fires when cast session start failed.

CAST_SESSION_STARTING

Fires when cast session starting.

CAST_SESSION_STARTED

Fires when cast session started.

CAST_SESSION_ENDING

Fires when cast session ending.

CAST_SESSION_ENDED

Fires when cast session ended.

CAST_AVAILABLE

Fires when cast is available.

PlayerSnapshot

Parameters

  • player KalturaPlayer The Kaltura player.

textStyle

Type: TextStyle

advertising

Type: Object

config

Type: Object

RemoteControl

Parameters

  • player KalturaPlayer The Kaltura player.

getPlayerSnapshot

Gets the player snapshot.

Type: Function

Returns PlayerSnapshot player snapshot.

getUIWrapper

Gets the UI wrapper.

Type: Function

Returns UIWrapper The UI wrapper.

onRemoteDeviceDisconnected

On remote device disconnected handler.

Type: Function

Parameters

Returns void

onRemoteDeviceConnected

On remote device connected handler.

Type: Function

Parameters

Returns void

onRemoteDeviceAvailable

On remote device available handler.

Type: Function

Parameters

Returns void

onRemoteDeviceConnecting

On remote device connecting handler.

Type: Function

Returns void

onRemoteDeviceDisconnecting

On remote device disconnecting handler.

Type: Function

Returns void

onRemoteDeviceConnectFailed

On remote device connect failed handler.

Type: Function

Returns void

RemotePayload

Parameters

player

The active remote player.

Type: BaseRemotePlayer

Returns BaseRemotePlayer

RemoteConnectedPayload

Extends RemotePayload

Parameters

ui

Remote player UI preset.

Type: RemotePlayerUI?

Returns RemotePlayerUI?

session

Remote session.

Type: RemoteSession

Returns RemoteSession?

RemoteDisconnectedPayload

Extends RemotePayload

Parameters

snapshot

Remote player snapshot.

Type: PlayerSnapshot

Returns PlayerSnapshot

RemoteAvailablePayload

Extends RemotePayload

Parameters

available

Remote player availability.

Type: boolean

Returns boolean

RemotePlayerUI

playbackUI

Playback UI of the remote player.

Parameters

  • props Object UI creation parameters.

Returns React$Element<any> Component.

idleUI

Idle UI of the remote player.

Parameters

  • props Object UI creation parameters.

Returns React$Element<any> Component.

adsUI

Idle UI of the remote player.

Parameters

  • props Object UI creation parameters.

Returns React$Element<any> Component.

liveUI

Live UI of the remote player.

Parameters

  • props Object UI creation parameters.

Returns React$Element<any> Component.

errorUI

Error UI of the remote player.

Parameters

  • props Object UI creation parameters.

Returns React$Element<any> Component.

uis

UI presets.

Type: Array<UIPreset>

Returns Array<UIPreset>

IRemotePlayer

textStyle

Type: TextStyle

muted

Type: boolean

playbackRate

Type: number

volume

Type: number

currentTime

Type: number

buffered

Type: number

duration

Type: number

liveDuration

Type: number

paused

Type: boolean

ended

Type: boolean

seeking

Type: boolean

src

Type: string

poster

Type: string

engineType

Type: string

streamType

Type: string

type

Type: string

ads

Type: Object

config

Type: KPOptionsObject

addEventListener

Parameters

Returns void

removeEventListener

Parameters

Returns void

dispatchEvent

Parameters

  • event FakeEvent

Returns void

loadMedia

Parameters

Returns Promise<any>

setMedia

Parameters

Returns void

getMediaInfo

Returns Object

getMediaConfig

Returns Object

configure

Parameters

Returns void

ready

Returns Promise<any>

load

Returns void

play

Returns void

pause

Returns void

reset

Returns void

destroy

Returns void

isLive

Returns boolean

isDvr

Returns boolean

seekToLiveEdge

Returns void

getStartTimeOfDvrWindow

Returns number

getTracks

Parameters

Returns Array<Track>

getActiveTracks

Returns Object

selectTrack

Parameters

  • track Track

Returns void

hideTextTrack

Returns void

enableAdaptiveBitrate

Returns void

isAdaptiveBitrateEnabled

Returns boolean

setTextDisplaySettings

Parameters

Returns void

startCasting

Returns void

stopCasting

Returns void

isCasting

Returns boolean

isCastAvailable

Returns boolean

getCastSession

Returns RemoteSession

isVr

Returns boolean

toggleVrStereoMode

Returns void

isInVrStereoMode

Returns boolean

RemoteSession

Parameters

  • id string Session ID.
  • friendlyName string Receiver friendly name.
  • resuming boolean? Whether the session is resuming.

deviceFriendlyName

Receiver friendly name.

Type: string

Returns string

id

Session ID.

Type: string

Returns string

resuming

Whether the session is resuming.

Type: boolean?

Returns boolean?

AdsController

Parameters

  • player Player The player.
  • adsPluginController IAdsController The controller of the current ads plugin instance.

allAdsCompleted

Type: boolean

Returns boolean Whether all ads completed.

isAdPlaying

Returns boolean Whether an ad is playing.

isAdBreak

Returns boolean Whether we're in an ad break.

getAdBreaksLayout

Returns Array<(number | string)> The ad breaks layout (cue points).

getAdBreak

Returns AdBreak? Gets the current ad break data.

getAd

Returns Ad? Gets the current ad data.

skipAd

Skip on an ad.

Returns void

playAdNow

Play an ad on demand.

Parameters

Returns void

ControllerProvider

Controller provider

Parameters

getAdsControllers

Get the ads controller of the all ads plugins.

Returns Array<IAdsPluginController> the ads controllers.

PlaylistEventType

Type: Object

Examples

// Events lifecycle
1. PLAYLIST_LOADED
2. PLAYLIST_ITEM_CHANGED (multiple)
3. PLAYLIST_ENDED
// How to use
player.addEventListener(KalturaPlayer.playlist.PlaylistEventType.PLAYLIST_LOADED, e => {
  console.log(e.payload.playlist.metadata.name);
};

PLAYLIST_LOADED

Fires when the playlist has been loaded.

PLAYLIST_ITEM_CHANGED

Fires when a playlist item start to changed.

PLAYLIST_ENDED

Fires when the playlist has finished.

PlaylistItem

Parameters

updateSources

Update the playlist item sources

Parameters

  • sourcesObject PKSourcesConfigObject The sources

Returns void

updatePlugins

Update the playlist item plugins (e.g. bumper from BE)

Parameters

Returns void

sources

Playlist item sources

Type: PKSourcesConfigObject?

Returns PKSourcesConfigObject?

config

Playlist item config

Type: KPPlaylistItemConfigObject?

Returns KPPlaylistItemConfigObject?

plugins

Playlist item plugins

Type: KPPluginsConfigObject

Returns KPPluginsConfigObject

index

Playlist item index

Type: number

Returns number

isPlayable

Returns boolean = Whether the playlist item has sources to play

PlaylistManager

Parameters

  • player KalturaPlayer The player instance
  • options KPOptionsObject The player config object

configure

Config the playlist

Parameters

  • config KPPlaylistObject? The playlist config
  • entryList ProviderEntryListObject? Entry list

Returns void

load

Load a playlist

Parameters

Returns void

reset

Reset the playlist

Returns void

playNext

Play the next item

Returns void

playPrev

Play the previous item

Returns void

playItem

Play a specific item

Parameters

  • index number The index of the item to play

Returns void

items

Playlist items

Type: Array<PlaylistItem>

Returns Array<PlaylistItem>

current

Current item

Type: PlaylistItem?

Returns PlaylistItem?

next

Next item

Type: PlaylistItem?

Returns PlaylistItem?

prev

Previous item

Type: PlaylistItem?

Returns PlaylistItem?

id

Playlist id

Type: string

Returns string

metadata

Playlist metadata

Type: ProviderPlaylistMetadataObject

Returns ProviderPlaylistMetadataObject

poster

Playlist poster

Type: string?

Returns string?

countdown

Playlist countdown

Type: KPPlaylistCountdownOptions

Returns KPPlaylistCountdownOptions

options

Playlist options

Type: KPPlaylistOptions

Returns KPPlaylistOptions

BasePlugin

The BasePlugin responsible to implement the plugin interface. Contains several default implementations. Other plugins should extend this class.

Parameters

  • name string The plugin name
  • player Object The player reference
  • config Object The plugin configuration

config

The runtime configuration of the plugin.

Type: Object

name

The name of the plugin.

Type: string

player

The logger of the plugin.

Type: Object

player

Reference to the actual player.

Type: Object

eventManager

The event manager of the plugin.

Type: EventManager

getConfig

Getter for the configuration of the plugin.

Parameters

  • attr string The key in the plugin configuration (optional).

Returns any If attribute is provided, returns its value. Else, Returns the config of the plugin.

ready

Getter for the ready promise of the plugin.

Type: Promise<any>

Returns Promise<any> returns a resolved promise unless the plugin overrides this ready getter.

updateConfig

Updates the config of the plugin.

Parameters

  • update Object The updated configuration.

Returns void

loadMedia

Runs the loadMedia logic of the plugin. plugin must implement this method.

Returns void

destroy

Runs the destroy logic of the plugin. plugin must implement this method.

Returns void

reset

Runs the reset logic of the plugin. plugin must implement this method.

Returns void

getName

Getter for the plugin's name.

Returns string The name of the plugin.

dispatchEvent

Dispatch an event via the plugin.

Parameters

  • name string The event name.
  • payload any The event payload.

Returns void

defaultConfig

The default configuration of the plugin. Inherited plugins should override this property.

Type: Object

createPlugin

Factory method to create the actual plugin.

Parameters

  • name string The plugin name
  • player Object The player reference
  • config Object The plugin configuration (optional, default {})

Returns BasePlugin New runtime plugin instance

isValid

Returns under what conditions the plugin is valid. Plugin must implement this method.

Returns boolean Whether the plugin is valid and can be initiated. Default implementation is true

PluginManager

The PluginManager responsible for register plugins definitions and store plugins instances.

load

Creates and store new instance of the plugin in case isValid() of the plugin returns true.

Parameters

  • name string The plugin name
  • player Object The player reference
  • config Object The plugin configuration (optional, default {})

Returns boolean Whether the plugin load was successful

loadMedia

Iterates over all the plugins and calls loadMedia().

Returns void

destroy

Iterates over all the plugins and calls destroy().

Returns void

reset

Iterates over all the plugins and calls reset() method of the plugin's impl.

Returns void

get

Returns the plugin's instance.

Parameters

  • name string The plugin name.

Returns BasePlugin The plugin instance.

getAll

Returns all plugins.

Returns Object All plugins.

register

Writes the plugin in the registry. Maps: plugin name -> plugin class.

Parameters

Returns boolean If the registration request succeeded

unRegister

Removes the plugin from the registry.

Parameters

Returns void

registerPlugin

Export the register method.

Type: function

load

Load middleware handler.

Parameters

  • next Function The load handler in the middleware chain.

Returns void

play

Play middleware handler.

Parameters

  • next Function The play handler in the middleware chain.

Returns void

constructor

constructor

get

return the token store object

Returns (any | any) token store object

set

recalculate the token store data, if new config with token is passed then add it to the data store, and if an existing token needs to be removed then remove it

Parameters

  • pluginsConfig dataStoreType? the new config object

Returns void

reset

reset the config store to its initial state

Returns void

constructor

constructor

evaluatePluginsConfig

Parameters

Returns void

ServiceProvider

register

Parameters

  • name string the service name
  • service Object the service object

Returns void

get

Parameters

  • name string the service name

Returns Object the service object

has

Parameters

  • name string the service name

Returns boolean if the service exist

reset

Returns void

destroy

Returns void

getRedirectExternalStreamsHandler

Get the redirect external stream handler.

Parameters

  • playerOptions KPOptionsObject The player config.
  • mediaOptions KPOptionsObject The media config. (optional, default {})

Returns void

SupportedOptions

enum for supported options

Type: Object

getMediaCapabilities

get the media capabilities

Parameters

Returns Promise<MediaCapabilitiesObject> The media capabilities object.

getMediaCapabilities

get the media capabilities

Parameters

Returns Promise<MediaCapabilitiesObject> The media capabilities object.

maybeSetStreamPriority

set stream priority according to playerConfig

Parameters

  • player Player player
  • sources PKSourcesConfigObject sources

Returns void

hasYoutubeSource

returns true if sources contain youtube video source

Parameters

  • sources PKSourcesConfigObject thr sources object

Returns boolean true if sources contain youtube source

hasImageSource

returns true if sources contain image source

hasDocumentSource

returns true if sources contain document source

Parameters

  • sources PKSourcesConfigObject thr sources object

Returns boolean true if sources contain image source

mergeProviderPluginsConfig

Merge the provider plugins config (e.g. bumper) into the app config and returns it and the respective app config to restore in change media

Parameters

  • providerPluginsConfig KPPluginsConfigObject the provider plugins config
  • appPluginsConfig KPOptionsObject the entire app plugins config

Returns Array<KPPluginsConfigObject> the merged plugins config and the partial respective app plugins config

ViewabilityManager

A service class to observe viewability of elements in the view port.

Parameters

  • viewabilityConfig number the configuration needed to create the manager (optional, default {})

observe

Parameters

  • target HTMLElement the targeted element to check its visibility
  • listener Function the callback to be invoked when visibility is changed (and when starting to observe). The callback is called with a boolean param representing the visibility state
  • optionalThreshold number? a number between 0 to 100 that represents the minimum visible percentage considered as visible

Returns void

unObserve

Remove the listener from the target

Parameters

  • target HTMLElement the targeted element to remove the listener
  • listener Function the callback function to be removed

Returns void

destroy

cleans all memory allocations.

loadMedia

Loads a media.

Parameters

  • mediaInfo ProviderMediaInfoObject The media info.
  • mediaOptions PKSourcesConfigObject? The media options.

Examples

kalturaPlayer.loadMedia({entryId: 'entry123'}, {startTime: 5, poster: 'my/poster/url'});

Returns Promise<any> Promise which resolves when the media is loaded, or rejected if error occurs.

setMedia

sets a media.

Parameters

Returns void

loadPlaylist

Loads a playlist by id.

Parameters

  • playlistInfo ProviderPlaylistInfoObject The playlist info.
  • playlistConfig KPPlaylistConfigObject? The playlist config.

Examples

kalturaPlayer.loadPlaylist({playlistId: '123456'}, {options: {autoContinue: false}});

Returns Promise<ProviderPlaylistObject> The playlist data from the provider.

loadPlaylistByEntryList

Loads a playlist by entry list.

Parameters

  • entryList ProviderEntryListObject The playlist info.
  • playlistConfig KPPlaylistConfigObject? The playlist config.

Examples

kalturaPlayer.loadPlaylistByEntryList({entries: [{entryId: '01234'}, {entryId: '56789'}]}, {options: {autoContinue: false}});

Returns Promise<ProviderPlaylistObject> The playlist data from the provider.

getDrmInfo

returns the media drm info.

Returns PKDrmDataObject the drm info

setSourcesMetadata

Config the player.

Parameters

  • sourcesMetadata PKMetadataConfigObject The player sources metadata config.

Examples

kalturaPlayer.setSourcesMetadata({epgId: '1234'});

Returns void

configure

Config the player.

Parameters

  • config Object The player config. (optional, default {})

Examples

kalturaPlayer.configure({playback: {autoplay: true}});

Returns void

isLive

Is the current media a live media.

Examples

KalturaPlayer.isLive();

Returns boolean boolean if isLive

isDvr

Does the current media contain a DVR window.

Examples

KalturaPlayer.isDvr();

Returns boolean boolean if isDvr

isFullscreen

Is in full screen mode.

Examples

KalturaPlayer.isFullscreen();

Returns boolean boolean if isFullscreen

enterFullscreen

Enter full screen mode.

Parameters

  • fullScreenElementId string fullScreenElementId is optional will use targetId if not provided

Examples

KalturaPlayer.enterFullscreen();

Returns void

exitFullscreen

Exit full screen mode.

Examples

KalturaPlayer.exitFullscreen();

Returns void

enterPictureInPicture

Enter picture in picture mode.

Examples

KalturaPlayer.enterPictureInPicture();

Returns void

exitPictureInPicture

Exit picture in picture mode.

Examples

KalturaPlayer.exitPictureInPicture();

Returns void

isInPictureInPicture

Is in picture in picture mode.

Examples

KalturaPlayer.isInPictureInPicture();

Returns boolean boolean if isInPictureInPicture

isPictureInPictureSupported

Is in picture in picture mode supported.

Examples

KalturaPlayer.isPictureInPictureSupported();

Returns boolean boolean if isPictureInPictureSupported

normalizedCurrentTime

In VOD playback this setter is like the regular currentTime setter. In live playback this setter normalizes the seek point to be relative to the start of the DVR window. This setter is useful to display a seekbar presents the available seek range only.

Type: number

Parameters

  • to Number The number to set in seconds (from 0 to the normalized duration).

Returns void

normalizedCurrentTime

In VOD playback this getter is like the regular currentTime getter. In live playback this getter normalizes the current time to be relative to the start of the DVR window. This getter is useful to display a seekbar presents the available seek range only.

Type: number

Returns number

normalizedDuration

In VOD playback this getter is like the regular duration getter. In live playback this getter normalizes the duration to be relative to the start of the DVR window. This getter is useful to display a seekbar presents the available seek range only.

Type: number

Returns number

playlist

The playlist controller.

Type: PlaylistManager

Examples

KalturaPlayer.playlist.playNext();

Returns PlaylistManager

crossOrigin

Set crossOrigin attribute.

Type: string?

Parameters

  • crossOrigin string? 'anonymous', 'use-credentials' or null to remove attribute anonymous: CORS requests for this element will not have the credentials flag set. use-credentials: CORS requests for this element will have the credentials flag set; this means the request will provide credentials.

Returns void

crossOrigin

Get crossOrigin attribute.

Type: string?

Returns string? 'anonymous' or 'use-credentials'

isVisible

Gets the player visibility state

Type: boolean

Returns boolean whether the player is in the active browser tab and visible in the view port

viewabilityManager

Gets the player viewability manager service

Type: ViewabilityManager

Returns ViewabilityManager player viewability manager

getService

Gets a registered service of that name

Parameters

  • name string the service name

Returns Object the service object

hasService

Checks if a service of that name has been registered

Parameters

  • name string the service name

Returns boolean if the service exist

registerService

Registers a service to be used across the player

Parameters

  • name string the service name
  • service Object the service object

Returns void

addTextTrack

Add text track

Parameters

  • kind string Specifies the kind of text track.
  • label string? A string specifying the label for the text track.

Returns TextTrack? A TextTrack Object, which represents the new text track.

getNativeTextTracks

get the native text tracks

Returns Array<TextTrack> The native TextTracks array.

getDefaultRedirectOptions

get the default config for forcing external stream redirect.

Parameters

  • playerOptions KPOptionsObject The player config.
  • mediaOptions KPOptionsObject The media config. (optional, default {})

Returns Object config object

getDefaultRedirectOptions

get the default config for forcing external stream redirect.

Parameters

  • playerOptions KPOptionsObject The player config.
  • mediaOptions KPOptionsObject The media config. (optional, default {})

Returns Object config object

getPlayers

get all instantiated players

Returns KalturaPlayers map of player ids and their respective instantiated player

getPlayer

get a player instance by id

Parameters

Returns (KalturaPlayer | null) the player if found by the supplied ID or null if key doesn't exist