Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface PlayerAPI

Bitmovin Player instance members.

Hierarchy

  • PlayerAPI

Index

Properties

DRM

DRM: any

EVENT

EVENT: Event

An enumeration of all player events.

EVENTS

EVENTS: Event[]

A list of all player event values.

LOGLEVEL

LOGLEVEL: LogLevel

An enumeration of possible log levels.

LOGLEVELS

LOGLEVELS: LogLevel[]

A list of all possible log level values.

VR

The VR namespace.

version

version: string

The version number of the player.

vr

The VR API.

Methods

addEventHandler

  • Subscribes an event handler to a player event.

    since

    v4.0

    deprecated

    Replaced by PlayerAPI.on

    Parameters

    • eventType: Event

      The type of event to subscribe to.

    • callback: PlayerEventCallback

      The event callback handler that will be called when the event fires.

    Returns PlayerAPI

addMetadata

  • addMetadata(metadataType: CAST, metadata: any): boolean
  • Sends custom metadata to a remote receiver app (e.g. Chromecast).

    since

    v4.0

    Parameters

    • metadataType: CAST

      The type of the metadata. Currently only 'CAST' is supported.

    • metadata: any

      The custom data to send to the receiver.

    Returns boolean

    True if it was successful.

addSubtitle

  • Adds a new external subtitle/caption track. The track is only added to the available tracks but not activated. If the ID already exists, the existing subtitle/caption track is overwritten with the new one. Call setSubtitle to activate it.

    since

    v4.0

    Parameters

    • subtitle: Subtitle

      the subtitle to add

    Returns PlayerAPI

castStop

castVideo

  • Initiates casting the current video to a Cast-compatible device. The user has to choose the target device.

    since

    v4.0

    Returns PlayerAPI

clearQueryParameters

destroy

  • Unloads the player and removes all inserted HTML elements and event handlers.

    since

    v4.0

    Returns PlayerAPI

enterFullscreen

  • enterFullscreen(fullscreenElement?: HTMLElement): PlayerAPI
  • Switch player to fullscreen mode. Has no effect if already in fullscreen.

    Parameters

    • Optional fullscreenElement: HTMLElement

      An optional alternative element to be put into fullscreen instead of the default player (container) element (since 7.8).

    Returns PlayerAPI

enterPictureInPicture

  • Enter picture in picture mode.

    since

    v7.1

    Returns PlayerAPI

exitFullscreen

  • Exit player fullscreen mode. Has no effect if not in fullscreen.

    since

    v4.0

    Returns PlayerAPI

exitPictureInPicture

  • Exit picture in picture mode.

    since

    v7.1

    Returns PlayerAPI

getAudio

  • Returns the currently used audio track.

    since

    v4.0

    Returns AudioTrack

getAudioBufferLength

  • getAudioBufferLength(): number | null
  • Returns the seconds of already buffered audio data or null if no audio source is loaded.

    since

    v4.0

    Returns number | null

getAudioQuality

getAvailableAudio

  • Returns an array of all available audio tracks.

    since

    v4.0

    Returns AudioTrack[]

getAvailableAudioQualities

  • Returns an array of all available audio qualities the player can adapt between.

    since

    v4.0

    Returns AudioQuality[]

getAvailableImpressionServers

  • getAvailableImpressionServers(): string[]
  • Returns a list of available impression servers.

    since

    v4.0

    Returns string[]

getAvailableLicenseServers

  • getAvailableLicenseServers(): string[]
  • Returns a list of available license servers.

    since

    v4.0

    Returns string[]

getAvailableSegments

  • Returns infos for segments that can be requested by the player

    since

    v7.2

    Returns SegmentMap

getAvailableSubtitles

  • Returns an array of all available subtitle/caption tracks.

    since

    v4.0

    Returns Subtitle[]

getAvailableVideoQualities

  • Returns an array containing all available video qualities the player can adapt between.

    since

    v4.0

    Returns VideoQuality[]

getBufferedRanges

  • Returns the currently buffered time ranges of the video element.

    since

    v6.1

    Returns TimeRange[]

getConfig

  • getConfig(mergedConfig?: boolean): any
  • Returns the config object of the current player instance.

    since

    v4.0

    Parameters

    • Optional mergedConfig: boolean

      true to return the config expanded with all default values, false to return the user config passed to setup

    Returns any

    The current user or merged player config.

getCurrentTime

  • getCurrentTime(): number
  • Returns the current playback time in seconds of the video.

    since

    v4.0

    Returns number

getDownloadedAudioData

getDownloadedVideoData

getDroppedFrames

  • getDroppedFrames(): number
  • Returns the total number of dropped frames since playback started.

    since

    v4.0

    Returns number

getDuration

  • getDuration(): number
  • Returns the total duration in seconds of the current video or {@code Infinity} if it’s a live stream.

    since

    v4.0

    Returns number

getFigure

  • getFigure(): HTMLElement
  • Returns the figure element that the player is embedded in, if the player is set up, or null otherwise.

    since

    v4.0

    Returns HTMLElement

getManifest

  • getManifest(): string
  • Returns the used DASH or HLS manifest file.

    Previous player versions (v4.2-v7.0) returned an object for DASH and a string for HLS, this has been corrected in v7.1.

    since

    v7.1

    Returns string

getMaxTimeShift

  • getMaxTimeShift(): number
  • Returns the limit in seconds for time shift. Is either negative or 0 and applicable to live streams only.

    since

    v4.0

    Returns number

getPlaybackAudioData

  • Returns data about the currently playing audio segment.

    since

    v4.0

    Returns AudioQuality

getPlaybackSpeed

  • getPlaybackSpeed(): number
  • Returns the current playback speed of the player. 1 is the default playback speed, values between 0 and 1 refer to slow motion and values greater than 1 refer to fast forward. Values less or equal zero are ignored.

    since

    v4.0

    Returns number

getPlaybackVideoData

  • Returns data about the currently playing video segment.

    since

    v4.0

    Returns VideoQuality

getPlayerType

  • Returns the currently used rendering mode. See PlayerType for details of the valid values.

    since

    v4.0

    Returns PlayerType

getSeekableRange

  • Returns the time range that is currently valid for seeking.

    since

    v7.1

    Returns TimeRange

getSnapshot

  • getSnapshot(type?: string, quality?: number): Snapshot
  • Creates a snapshot of the current video frame. Snapshots cannot be taken from DRM protected content and the Flash fallback.

    since

    v4.0

    Parameters

    • Optional type: string

      The type of image snapshot to capture. Allowed values are 'image/jpeg' and 'image/webp'.

    • Optional quality: number

      A number between 0 and 1 indicating the image quality.

    Returns Snapshot

getStreamType

  • Returns the currently used streaming technology. See StreamType for details of the valid values.

    since

    v4.0

    Returns StreamType

getSubtitle

  • Returns the currently used subtitle/caption track.

    since

    v4.0

    Returns Subtitle

getSupportedDRM

  • getSupportedDRM(): Promise<string[]>
  • Tests and retrieves a list of all supported DRM systems in the current user agent.

    since

    v4.1

    Returns Promise<string[]>

    A Promise that resolves to an array of strings with the supported DRM systems after fulfillment. Should never be rejected.

getSupportedTech

  • Returns an array of objects denoting a player and streaming technology combination supported on the current platform. The order in the array is the order which will be used to play a stream.

    since

    v4.0

    Returns Technology[]

getThumb

  • Returns a thumbnail image for a certain time or null if there is no thumbnail available. Requires a configured thumbnails track in SourceConfig.tracks.

    since

    v4.0

    Parameters

    • time: number

      the media time for which the thumbnail should be returned

    Returns Thumbnail

    A thumbnail if a thumbnails track is configured and a thumbnail exists for the specified time, else null

getTimeShift

  • getTimeShift(): number
  • Returns the current time shift offset to the live edge in seconds. Only applicable to live streams.

    since

    v4.0

    Returns number

getTotalStalledTime

  • getTotalStalledTime(): number
  • Returns the stalled time in seconds since playback started.

    since

    v4.0

    Returns number

getVRStatus

  • Returns the current VR playback status.

    since

    v6.0

    Returns Status

getVideoBufferLength

  • getVideoBufferLength(): number | null
  • Returns the seconds of already buffered video data or null if no video source is loaded.

    since

    v4.0

    Returns number | null

getVideoElement

  • getVideoElement(): HTMLVideoElement | HTMLObjectElement
  • Returns the used HTML5 video element or the Flash object if the fallback is used.

    Returns HTMLVideoElement | HTMLObjectElement

    The HTML5 video element or the Flash object which is used by the player

getVideoQuality

getVolume

  • getVolume(): number
  • Returns the player’s volume between 0 (silent) and 100 (max volume).

    since

    v4.0

    Returns number

hasEnded

  • hasEnded(): boolean
  • Returns true if the video has ended.

    since

    v4.0

    Returns boolean

isAd

  • isAd(pending?: boolean): boolean
  • Returns true while an ad is played back or content playback has been paused for ad playback, false otherwise.

    since

    v6.1

    Parameters

    • Optional pending: boolean

      If true, isAd will return true if the content playback has been paused for playback of a pending ad

    Returns boolean

isAirplayActive

  • isAirplayActive(): boolean
  • Checks if Apple Airplay is enabled.

    since

    v7.8.4

    Returns boolean

isAirplayAvailable

  • isAirplayAvailable(): boolean
  • Checks if Apple AirPlay support is available.

    since

    v7.1

    Returns boolean

isCastAvailable

  • isCastAvailable(): boolean
  • Returns true if casting to another device (such as a ChromeCast) is available, otherwise false. Please note that this function only returns true after the Event.ON_CAST_AVAILABLE event has fired.

    since

    v5.2

    Returns boolean

isCasting

  • isCasting(): boolean
  • Returns true if the video is currently casted to a device and not played in the browser, or false if the video is played locally.

    since

    v4.0

    Returns boolean

isDRMSupported

  • isDRMSupported(drmSystem: string): Promise<string>
  • Checks if a DRM system is supported in the current user agent.

    since

    v4.1

    Parameters

    • drmSystem: string

      A KeySystem string to test against

    Returns Promise<string>

    Resolves with the DRM system string if it is supported, or rejects with an error message if not

isFullscreen

  • isFullscreen(): boolean
  • Returns true if the player is currently in fullscreen mode.

    since

    v4.0

    Returns boolean

isLive

  • isLive(): boolean
  • Return true if the displayed video is a live stream.

    since

    v4.0

    Returns boolean

isMuted

  • isMuted(): boolean
  • Returns true if the player has been muted.

    since

    v4.0

    Returns boolean

isPaused

  • isPaused(): boolean
  • Returns true if the player has started playback but is currently paused.

    since

    v4.0

    Returns boolean

isPictureInPicture

  • isPictureInPicture(): boolean
  • Returns the status of picture in picture mode.

    since

    v7.1

    Returns boolean

isPictureInPictureAvailable

  • isPictureInPictureAvailable(): boolean
  • Checks if macOS picture in picture mode is available.

    since

    v7.1

    Returns boolean

isPlaying

  • isPlaying(): boolean
  • Returns true if the player is currently playing, i.e. has started and is not paused.

    since

    v4.0

    Returns boolean

isReady

  • isReady(): boolean
  • Returns true if the player has finished initialization and is ready to use and to handle other API calls.

    since

    v4.0

    Returns boolean

isSetup

  • isSetup(): boolean
  • Returns true if the setup call has already been successfully called.

    since

    v4.0

    Returns boolean

isStalled

  • isStalled(): boolean
  • Returns true if the player is currently stalling due to an empty buffer.

    since

    v4.0

    Returns boolean

load

  • Sets a new video source and returns a promise which resolves to the player. The load call is only available after the ON_READY event has been triggered, or the setup promise did resolve.

    since

    v4.0

    Parameters

    • source: SourceConfig

      A source object as specified in player configuration during setup

    • Optional forceTechnology: string

      Forces the player to use the specified playback and streaming technology. The specified technologies have to be separated by a period (e.g. 'html5.hls'). A list of valid combinations can retrieved by calling getSupportedTech.

    • Optional disableSeeking: boolean

      If set, seeking will be disabled

    Returns Promise<PlayerAPI>

mute

  • Mutes the player if an audio track is available. Has no effect if the player is already muted.

    since

    v4.0

    Parameters

    • Optional issuer: string

      The issuer of the API call that will be passed to events triggered by this call

    Returns PlayerAPI

off

  • Removes a handler for a player event.

    since

    v7.8

    Parameters

    Returns void

on

  • Subscribes an event handler to a player event.

    since

    v7.8

    Parameters

    • eventType: Event

      The type of event to subscribe to.

    • callback: PlayerEventCallback

      The event callback handler that will be called when the event fires.

    Returns void

pause

  • Pauses the video if it is playing. Has no effect if the player is already paused.

    since

    v4.0

    Parameters

    • Optional issuer: string

      The issuer of the API call that will be passed to events triggered by this call

    Returns PlayerAPI

play

  • Starts playback or resumes after being paused. No need to call it if the player is setup with autoplay attribute (PlaybackConfig.autoplay). Has no effect if the player is already playing.

    since

    v4.0

    Parameters

    • Optional issuer: string

      The issuer of the API call that will be passed to events triggered by this call

    Returns PlayerAPI

preload

  • Starts preloading the content of the currently loaded source.

    since

    v6.1

    Returns PlayerAPI

removeEventHandler

  • Removes a handler for a player event.

    since

    v4.0

    deprecated

    Replaced by PlayerAPI.off

    Parameters

    Returns PlayerAPI

removeSubtitle

  • removeSubtitle(subtitleTrackID: string): PlayerAPI
  • Removes the existing subtitle/caption track with the track ID specified by trackID. If the track is currently active, it will be deactivated and then removed. If no track with the given ID exists, the call will be ignored. To disable an active subtitle track, call setSubtitle with null.

    since

    v4.0

    Parameters

    • subtitleTrackID: string

      The ID of the subtitle to remove

    Returns PlayerAPI

scheduleAd

  • Schedules an ad for playback.

    since

    v4.2

    Parameters

    • adManifestUrl: string | AdManifest[]

      URL to the ad manifest. The array is used for ad waterfalling: all entries beyond the first are fallbacks if the previous ones did not work.

    • client: AdClient

      the type of ad to be played.

    • Optional options: ScheduleAdOptions

      Optional options for ad playback.

    Returns boolean

    true if scheduling the ad was successful, false otherwise.

seek

  • seek(time: number, issuer?: string): boolean
  • Seeks to the given playback time specified by the parameter time in seconds. Must not be greater than the total duration of the video. Has no effect when watching a live stream as seeking is not possible.

    since

    v4.0

    Parameters

    • time: number

      The time to seek to

    • Optional issuer: string

      The issuer of the API call that will be passed to events triggered by this call

    Returns boolean

setAudio

  • Sets the audio track to the ID specified by trackID. Available tracks can be retrieved with getAvailableAudio.

    since

    v4.0

    Parameters

    • trackID: string

      The ID of the audio track to activate

    Returns PlayerAPI

setAudioQuality

  • setAudioQuality(audioQualityID: string): PlayerAPI
  • Manually sets the audio stream to a fixed quality, identified by ID. Has to be an ID defined in the MPD or the keyword 'auto'. Auto resets to dynamic switching. A list with valid IDs can be retrieved by calling getAvailableAudioQualities.

    since

    v4.0

    Parameters

    • audioQualityID: string

      The ID of the desired audio quality or 'auto' for dynamic switching

    Returns PlayerAPI

setAuthentication

  • setAuthentication(customData: any): PlayerAPI
  • Sets authentication data which is sent along with the licensing call. Can be used to add more information for a 3rd party licensing backend. The data be any type or object as needed by the 3rd party licensing backend.

    since

    v4.2

    Parameters

    • customData: any

      Data which should be sent with the licensing call

    Returns PlayerAPI

setLastSegment

  • setLastSegment(lastSegmentNum: number): PlayerAPI
  • Sets the number of the last segment that the player is allowed to request. Only working with Segment Template manifests.

    since

    v4.0

    Parameters

    • lastSegmentNum: number

      The number of the last segment to request

    Returns PlayerAPI

setLogLevel

  • Sets the level of player log outputs.

    since

    v6.1

    Parameters

    • level: LogLevel

      Log level, allowed values are "debug", "log", "warn", "error" and "off"

    Returns PlayerAPI

setPlaybackSpeed

  • [HTML5 only] Sets the playback speed of the player. Fast forward as well as slow motion is supported. Slow motion is used by values between 0 and 1, fast forward by values greater than 1.

    see

    getPlaybackSpeed

    since

    v4.0

    Parameters

    • speed: number

      A playback speed factor greater than 0

    Returns PlayerAPI

setPosterImage

  • setPosterImage(url: string, keepPersistent: boolean): PlayerAPI
  • Sets a poster image. Will be displayed immediately, even if a video stream is playing.

    since

    v4.3

    Parameters

    • url: string

      The URL to the poster image

    • keepPersistent: boolean

      Flag to set the poster image persistent so it is also displayed during playback (useful for audio-only playback)

    Returns PlayerAPI

setQueryParameters

  • Adds GET parameters to all request URLs (e.g. manifest, media segments, subtitle files, …). The queryParameters should be an object with key value pairs, where the keys are used as parameter name and the values as parameter values.

    since

    v4.1

    Parameters

    • queryParameters: QueryParameters

      The list of query parameter key/value pairs

    Returns PlayerAPI

setSubtitle

  • Sets the subtitle track to the ID specified by trackID. A list can be retrieved by calling getAvailableSubtitles. Using null as ID disables subtitles.

    since

    v4.0

    Parameters

    • trackID: string

      The ID if the desired subtitle track or null to disable subtitles

    Returns PlayerAPI

setVRStereo

  • setVRStereo(enableStereo: boolean): boolean
  • Enables or disables stereo mode for VR content.

    since

    v6.0

    Parameters

    • enableStereo: boolean

      true to enable stereo, false to disable

    Returns boolean

    true if stereo mode was successfully set, else false

setVideoElement

  • setVideoElement(videoElement: HTMLElement): PlayerAPI
  • Passes an HTML video element to the player, which should be used in case of non-Flash playback. Needs to be called before setup. Has no effect if the Flash fallback is selected.

    since

    v5.1

    Parameters

    • videoElement: HTMLElement

      The HTML video element to use

    Returns PlayerAPI

setVideoQuality

  • setVideoQuality(videoQualityID: string): PlayerAPI
  • Manually sets the video stream to a fixed quality, identified by ID. Has to be an ID defined in the MPD or the keyword 'auto'. Auto resets to dynamic switching. A list with valid IDs can be retrieved by calling getAvailableVideoQualities.

    since

    v4.0

    Parameters

    • videoQualityID: string

      ID defined in the MPD or 'auto'

    Returns PlayerAPI

setVolume

  • setVolume(volume: number, issuer?: string): PlayerAPI
  • Sets the player’s volume in the range of 0 (silent) to 100 (max volume). Unmutes a muted player.

    since

    v4.0

    Parameters

    • volume: number

      The volume to set between 0 and 100

    • Optional issuer: string

      The issuer of the API call that will be passed to events triggered by this call

    Returns PlayerAPI

setup

  • Sets up a new player instance with the given configuration, as specified in player configuration documentation. Returns a promise that resolves to the player when setup is finished.

    since

    v4.0

    Parameters

    • userConfig: Config

      User-supplied configuration of the player

    • Optional forceTechnology: string

      Forces the player to use the specified playback and streaming technology. The specified technologies have to be separated by a period (e.g. 'html5.hls'). A list of valid combinations can retrieved by calling getSupportedTech.

    Returns Promise<PlayerAPI>

showAirplayTargetPicker

  • Shows the airplay playback target picker.

    since

    v7.1

    Returns PlayerAPI

skipAd

  • skipAd(): boolean
  • Skips the current ad. Has no effect if ad is not skippable or if no ad is played back.

    since

    v4.0

    Returns boolean

    True if skipping the ad was successful.

timeShift

  • timeShift(offset: number, issuer?: string): PlayerAPI
  • Shifts the time to the given offset in seconds from the live edge. Has to be within getMaxTimeShift (which is a negative value) and 0. Only works in live streams. [new in v4.3]: The offset can be positive and is then interpreted as a UNIX timestamp in seconds. The value has to be within the timeShift window as specified by getMaxTimeShift.

    since

    v4.0

    Parameters

    • offset: number

      The offset to timeshift to

    • Optional issuer: string

      The issuer of the API call that will be passed to events triggered by this call

    Returns PlayerAPI

unload

  • Unloads the current video source.

    since

    v4.0

    Returns PlayerAPI

unmute

  • Unmutes the player if muted.

    since

    v4.0

    Parameters

    • Optional issuer: string

      The issuer of the API call that will be passed to events triggered by this call

    Returns PlayerAPI

Generated using TypeDoc