Skip to main content

Player Methods

Track Management

isAutoBitrate()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns a value representing if auto bitrate switching is enabled or not.

note

For IOS & ROKU it always returns true.

Returns: boolean

player?.isAutoBitrate();

setAutoBitrate(autoBitrate)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Sets the automatic bitrate switching property.

note

Ignored on IOS & ROKU, ABR is always enabled.

ValueDescription
autoBitrate booleanEnable ABR

Returns: void

player?.setAutoBitrate(autoBitrate);

getTracks()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the loaded tracks in the player

Returns: lura.unified.Tracks

player?.getTracks();

useTrack(type, track)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Switches to the track of your choice that comes from getTracks() method.

ValueDescription
type lura.unified.TrackTypesType of the track
track lura.unified.VideoTrack | lura.unified.AudioTrack | lura.unified.CaptionTrackTrack that you want to switch to.
const x = player?.getTracks();
player?.useTrack(type, x.video[0]);

isDisplayingCaptions()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns a value representing if caption is displaying or not.

Returns: boolean

player?.isDisplayingCaptions();

displayCaptions(display)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Sets the displaying value of captions.

ValueDescription
display booleanDisplay captions

Returns: void

player?.displayCaptions(display);

Configuration Management

getConfig()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the configuration object provided by the user.

Returns: lura.unified.Configuration

player?.getConfig();

setConfig(config)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Configures the LuraPlayer based on the given configuration object.

ValueDescription
config lura.unified.ConfigurationInitial configuration of the lura player.

Returns: void

player?.setConfig(config);

updateConfig(config)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Partially updates the configuration. Updatable fields are marked as updatable in the Configuration section. (e.g. Title or plugin metadata)

ValueDescription
config lura.unified.ConfigurationUpdatable parts of the configuration.

Returns: void

player?.updateConfig(config);

destroy()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Destroys the player, disconnects all events, cleanup resources

Returns: void

player?.destroy();

reload()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Destroys the player, and reloads the current config.

Returns: void

player?.reload();

Playback Management Methods

play()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Requesting the video to play.

Returns: void

player?.play();

pause()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Requesting the video to pause.

Returns: void

player?.pause();

isAutoplay()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the autoplay setting of the player

Returns: boolean

player?.isAutoplay();

setAutoplay(autoplay)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Sets the autoplay setting of the player to the given value

ValueDescription
autoplay booleanAutoplay value you want to set

Returns: void

player?.setAutoplay(true);

isContentEnded()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns a boolean indicating whether the media content has ended

Returns: boolean

player?.isContentEnded();

isLoading()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Indicates if the player is loading

Returns: boolean

player?.isLoading();

isPaused()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns a boolean indicating whether the player is paused

Returns: boolean

player?.isPaused();

getVideoType()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the type of video ("VOD" or "LIVE")

Returns: lura.unified.VideoType

player?.getVideoType();

getMediaFormat()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the format of the media (e.g. "DASH", "HLS")

Returns: lura.unified.MediaFormat

player?.getMediaFormat();

getPlaybackSpeed()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the playback speed

Returns: number

player?.getPlaybackSpeed();

setPlaybackSpeed(speed)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Sets the playback speed between 0.1 and 16

ValueDescription
speed numberPlayback speed value you want to set

Returns: void

player?.setPlaybackSpeed(speed);

getVolume()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the current volume of the player

Returns: number

player?.getVolume();

setVolume(volume)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Sets the volume of the player to the given value

ValueDescription
volume numberA value between 0 and 1

Returns: void

player?.setVolume(volume);

isMuted()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns a boolean indicating whether the player is muted

Returns: boolean

player?.isMuted();

setMuted(muted)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Sets the muted setting of the player to the given value

ValueDescription
muted booleanWhether you want the video to be muted or not

Returns: void

player?.setMuted(muted);

getScreenState()

SDK v4.0.4 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the screen state, whether it should be picture in picture, fullscreen or windowed.

Returns: lura.unified.ScreenState

player?.getScreenState();

setScreenState(state)

SDK v4.0.4 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Sets the screen state, whether it should be picture in picture, fullscreen or windowed.

ValueDescription
state lura.unified.ScreenStateCurrent screen state

Returns: void

player?.setScreenState(state);

getDuration()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns video duration in seconds

Returns: number

player?.getDuration();

seek(time)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Seeks to a specific time (seconds). In live stream, seeking is only possible when there is availability window in the live stream. Availability windows will be present if the live stream has DVR enabled from the encoder.

ValueDescription
time numberTime in seconds that you want to seek to. For live streams, unix timestamp in seconds.

Returns: void

player?.seek(time);

catchLive()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Seeks to the end of the seekable range in live videos.

Returns: void

player?.catchLive();

getLivePosition()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the live position in live streams

Returns: number

player?.getLivePosition();

getBufferedDuration()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns buffered duration

Returns: number

player?.getBufferedDuration();

getBufferedStart()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns buffered start

Returns: number

player?.getBufferedStart();

getBufferedEnd()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns buffered end

Returns: number

player?.getBufferedEnd();

getCurrentTime()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns current playback time

Returns: number

player?.getCurrentTime();

requestTrickPlayImage(time, desiredWidth)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Requests the trick play image for a given time with image data closest to the desiredWidth. LuraPlayer will download and load the bif image closest to the desiredWidth and will return a base64 encoded JPG buffer (async) through TRICK_PLAY_DATA_EVENT after bif image is loaded.

ValueDescription
time numberPresentation time of the trick play image that you want to request.
desiredWidth numberDesired width of the trick play image.

Returns: void

player?.requestTrickPlayImage(time, desiredWidth);

getTrickPlayInformation()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the trick play information available in the player.

Returns: Array<{width: number, height: number}>

player?.getTrickPlayInformation();

getAvailabilityWindows()

Returns the available seekable ranges in a live stream.

Returns: lura.unified.AvailabilityWindow[]

player?.getAvailabilityWindows();

Playlist Methods

getPlaylistItems()

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Returns the items from the playlist configuration.

Returns: Array<lura.unified.Configuration>

player?.getPlaylistItems();

getPlaylistItem(index)

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Returns the item at the given index or null if not exists.

ValueDescription
index numberIndex of the playlist item that you want to get.

Returns: lura.unified.Configuration

player?.getPlaylistItem(index);

updatePlaylistItem(item, index)

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Updates the playlist item at the given index.

ValueDescription
item lura.unified.ConfigurationNew playlist item that you have updated.
index numberIndex of the playlist item that you want to update.

Returns: void

player?.updatePlaylistItem(item, index);

removePlaylistItem(index)

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Removes the playlist item at the given index.

ValueDescription
index numberIndex of the playlist item that you want to remove.

Returns: void

player?.removePlaylistItem(index);

addPlaylistItem(item, index)

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Adds a playlist item to the given index. If index is not provided, playlist item will be added as the last item.

ValueDescription
item lura.unified.ConfigurationNew playlist item that you want to insert.
index number | nullIndex of the playlist item that you want to add.

Returns: void

player?.addPlaylistItem(item, index);

getCurrentPlaylistItemIndex()

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Returns the index of the currently playing playlist item.

Returns: number

player?.getCurrentPlaylistItemIndex();

setPlaylistRepeat(repeat)

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Sets the value for whether the playlist should run in repeat mode or not.

ValueDescription
repeat booleanWhether the playlist should run in a loop or not.

Returns: void

player?.setPlaylistRepeat(repeat);

loadPlaylistItem(index)

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Loads the playlist item configuration with the given index if exists.

ValueDescription
index numberIndex of the playlist item that you want to play.

Returns: void

player?.loadPlaylistItem(index);

loadNextPlaylistItem()

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Loads the next item in the playlist. Will play the first item if this method is called at the last playlist item.

Returns: void

player?.loadNextPlaylistItem();

loadPreviousPlaylistItem()

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Loads the previous item in the playlist. Will play the last item if this method is called at the first playlist item.

Returns: void

player?.loadPreviousPlaylistItem();

setPlaylistAutoSwitchMechanism(autoSwitch)

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Enable/disable the automatic switching mechanism in between playlist items.

ValueDescription
autoSwitch booleanWhether auto switching mechanism should be enabled or not.

Returns: void

player?.setPlaylistAutoSwitchMechanism(autoSwitch);

abortPlaylistAutoSwitch()

SDK v4.0.8 +

SDK v4.0.5 +

SDK v4.0.3 +

Aborts the automatic switching mechanism for current switching. Auto switch will be turned on again for the next video if the auto switch mechanism is enabled.

Returns: void

player?.abortPlaylistAutoSwitch();

updatePlayerView(newPlayerView)

SDK v4.0.5 +

SDK v4.0.3 +

Updating LuraPlayerView to new instance of it.

ValueDescription
newPlayerView LuraPlayerViewNew instance of LuraPlayerView.

Returns: void

player?.updatePlayerView(newPlayerView = newPlayerView)

Ad Management Methods

getInterstitials()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the interstitials

Returns: Array<lura.unified.AdBreak>

player?.getInterstitials();

skipAd()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Skips the current ad

Returns: void

player?.skipAd();

Event Methods

addListener(listener)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Sets the event listener of the Lura Player. Returns an id for removing the listener.

ValueDescription
listener (e: lura.unified.UnifiedEvent<k: lura.unified.UnifiedEventName> => voidThe listener function when the event is dispatched

Returns: string

function handler(e) {
switch (e.type) {
case "CONFIGURED":
console.log("configured");
break;
default:
break;
}
}
player?.addListener(handler);

removeListener(listener)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Removes the event listener from the Lura Player.

ValueDescription
listener stringThe id of the listener function from addListener

Returns: void

player?.removeListener(listener);

Cast Management Methods

requestCasting(castTarget)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Requests casting to the selected target if available.

ValueDescription
castTarget lura.unified.CastTargetsThe list of cast targets that can be used.

Returns: void

player?.requestCasting(castTarget);

isCasting(castTarget)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns a value representing whether LuraPlayer is casting to a cast target or not.

ValueDescription
castTarget lura.unified.CastTargetsThe list of cast targets that can be used.

Returns: boolean

player?.isCasting(castTarget);

exitCasting(castTarget)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Ends or tries to end the casting of the cast target.

ValueDescription
castTarget lura.unified.CastTargetsThe list of cast targets that can be used.

Returns: void

player?.exitCasting(castTarget);

getCastingAvailability()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the availability of the casting targets.

Returns: {[key in lura.unified.CastTargets]?: boolean}

player?.getCastingAvailability();

Miscellaneous

setCustomData(key, value)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Sends custom data through the CUSTOM_DATA_CHANGED event.

ValueDescription
key stringKey of the custom data
value anyValue of the custom data.

Returns: void

player?.setCustomData(key, value);

getCustomData(key)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Gets the custom data for the given key.

ValueDescription
key stringKey of the custom data.

Returns: Any

player?.getCustomData(key);

getTimeUpdateData()

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Returns the TIME_UPDATED event payload for the current time.

player?.getTimeUpdateData();

notifyEvent(eventType, payload)

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

SDK v4.0.0 +

Notify the player for the ongoing UI events, such as ad click, icon click and so on. For usage guide, please refer to the Lura Player UI.

ValueDescription
eventType lura.unified.NotifiableEventTypeKey of the event type to be notified
payload anyValue of the notifiable event type.

Returns: void

player?.notifyEvent(eventType, payload);

Old Methods

requestFullscreen()

info

Deprecated, please use setScreenState

SDK v4.0.0 - 4.0.3

Requests fullscreen mode for the player

Returns: void

player?.requestFullscreen();

exitFullscreen()

info

Deprecated, please use setScreenState

SDK v4.0.0 - 4.0.3

Requests exiting the fullscreen mode for the player

Returns: void

player?.exitFullscreen();

isFullscreen()

info

Deprecated, please use getScreenState

SDK v4.0.0 - 4.0.3

Returns whether the player is in fullscreen mode or not.

Returns: boolean

player?.isFullscreen();

requestPictureInPicture()

info

Deprecated, please use setScreenState

SDK v4.0.0 - 4.0.3

Requests Picture-in-Picture mode

Returns: void

player?.requestPictureInPicture();

exitPictureInPicture()

info

Deprecated, please use setScreenState

SDK v4.0.0 - 4.0.3

Exits Picture-in-Picture mode

Returns: void

player?.exitPictureInPicture();

isPictureInPicture()

info

Deprecated, please use getScreenState

SDK v4.0.0 - 4.0.3

Returns whether the player is in picture in picture mode or not.

Returns: boolean

player?.isPictureInPicture();