Player Methods
Track Management
isAutoBitrate()
Returns a value representing if auto bitrate switching is enabled or not.
For IOS & ROKU it always returns true.
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: boolean
player?.isAutoBitrate();
Returns: Boolean
player?.isAutoBitrate()
Returns: Bool
player?.isAutoBitrate()
Returns: boolean
player.callFunc("isAutoBitrate");
setAutoBitrate(autoBitrate)
Sets the automatic bitrate switching property.
Ignored on IOS & ROKU, ABR is always enabled.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
autoBitrate boolean | Enable ABR |
Returns: void
player?.setAutoBitrate(autoBitrate);
Value | Description |
---|---|
autoBitrate Boolean | Enable ABR |
Returns: void
player?.setAutoBitrate(autoBitrate)
Value | Description |
---|---|
autoBitrate Bool | Enable ABR |
Returns: void
player?.setAutoBitrate(autoBitrate)
getTracks()
Returns the loaded tracks in the player
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: lura.unified.Tracks
player?.getTracks();
Returns: LuraTracks
player?.getTracks();
Returns: LuraTracks
player?.getTracks()
Returns: lura.interfaces.LuraTracks
player.callFunc("getTracks");
useTrack(type, track)
Switches to the track of your choice that comes from getTracks() method.
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
type lura.unified.TrackTypes | Type of the track |
track lura.unified.VideoTrack | lura.unified.AudioTrack | lura.unified.CaptionTrack | Track that you want to switch to. |
const x = player?.getTracks();
player?.useTrack(type, x.video[0]);
Value | Description |
---|---|
type String | "video" | "audio" | "caption" |
LuraTrack LuraTrack | Track that you want to switch to. |
val luraTracks = player?.getTracks()
player?.useTrack(type, luraTracks!!.videos[1])
Value | Description |
---|---|
type String | "video" | "audio" | "caption" |
track LuraTracks | Track that you want to switch to. |
var x = player?.getTracks();
player?.useTrack(type, x.video[0]);
Value | Description |
---|---|
type string | "video" | "audio" | "caption" |
track Object | Track that you want to switch to. |
tracks = player.callFunc("getTracks");
player.callFunc("useTrack", type, tracks.caption[0]);
isDisplayingCaptions()
Returns a value representing if caption is displaying or not.
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: boolean
player?.isDisplayingCaptions();
Returns: Boolean
player?.isDisplayingCaptions()
Returns: Bool
player?.isDisplayingCaptions()
Returns: boolean
player.callFunc("isDisplayingCaptions");
displayCaptions(display)
Sets the displaying value of captions.
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
display boolean | Display captions |
Returns: void
player?.displayCaptions(display);
Value | Description |
---|---|
display Boolean | Display captions |
Returns: void
player?.displayCaptions(display)
Value | Description |
---|---|
display Bool | Display captions |
Returns: void
player?.displayCaptions(display)
Value | Description |
---|---|
display boolean | Display captions |
Returns: invalid
player.callFunc("displayCaptions", display);
Configuration Management
getConfig()
Returns the configuration object provided by the user.
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: lura.unified.Configuration
player?.getConfig();
Returns: LuraConfiguration
player?.getConfig()
Returns: LuraConfiguration
player?.getConfig()
Returns: lura.configurations.LuraConfig
player.callFunc("getConfig");
setConfig(config)
Configures the LuraPlayer based on the given configuration object.
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
config lura.unified.Configuration | Initial configuration of the lura player. |
Returns: void
player?.setConfig(config);
Value | Description |
---|---|
config LuraConfiguration | Initial configuration of the lura player. |
Returns: void
player?.setConfig(config)
Value | Description |
---|---|
config LuraPlayerConfiguration | Initial configuration of the lura player. |
Returns: void
player?.setConfig(config)
Value | Description |
---|---|
config lura.unified.Configuration | Initial configuration of the lura player. |
Returns: invalid
player.callFunc("setConfig", config);
updateConfig(config)
Partially updates the configuration. Updatable fields are marked as updatable in the Configuration section. (e.g. Title or plugin metadata)
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
config lura.unified.Configuration | Updatable parts of the configuration. |
Returns: void
player?.updateConfig(config);
Value | Description |
---|---|
config LuraConfiguration | Updatable parts of the configuration. |
Returns: void
player?.updateConfig(config)
Value | Description |
---|---|
config LuraPlayerConfiguration | Updatable parts of the configuration. |
Returns: void
player?.updateConfig(config)
Value | Description |
---|---|
config lura.configurations.LuraConfig | Updatable parts of the configuration. |
Returns: invalid
player.callFunc("updateConfig", config);
destroy()
Destroys the player, disconnects all events, cleanup resources
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: void
player?.destroy();
Returns: void
player?.destroy()
Returns: void
player?.destroy()
Returns: invalid
player.callFunc("destroy");
reload()
Destroys the player, and reloads the current config.
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: void
player?.reload();
Returns: void
player?.reload()
Returns: void
player?.reload()
Returns: invalid
player.callFunc("reload");
Playback Management Methods
play()
Requesting the video to play.
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: void
player?.play();
Returns: void
player?.play()
Returns: void
player?.play()
Returns: invalid
player.callFunc("play");
pause()
Requesting the video to pause.
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: void
player?.pause();
Returns: void
player?.pause()
Returns: void
player?.pause()
Returns: invalid
player.callFunc("pause");
isAutoplay()
Returns the autoplay setting of the player
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: boolean
player?.isAutoplay();
Returns: Boolean
player?.autoplay;
Returns: Bool
player?.isAutoplay()
Returns: boolean
player.callFunc("isAutoplay");
setAutoplay(autoplay)
Sets the autoplay setting of the player to the given value
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
autoplay boolean | Autoplay value you want to set |
Returns: void
player?.setAutoplay(true);
Value | Description |
---|---|
isAutoplay Boolean | Autoplay value you want to set |
Returns: void
player?.setAutoplay(isAutoplay)
Value | Description |
---|---|
autoplay Bool | Autoplay value you want to set |
Returns: void
player?.setAutoplay(true)
Value | Description |
---|---|
autoplay boolean | Autoplay value you want to set |
Returns: invalid
player.callFunc("setAutoplay", true);
isContentEnded()
Returns a boolean indicating whether the media content has ended
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: boolean
player?.isContentEnded();
**Returns: Boolean
player?.isContentEnded
Returns: Bool
player?.isContentEnded()
Returns: boolean
player.callFunc("isContentEnded");
isLoading()
Indicates if the player is loading
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: boolean
player?.isLoading();
**Returns: Boolean
player?.isLoading
Returns: Bool
player?.isLoading()
Returns: boolean
player.callFunc("isLoading");
isPaused()
Returns a boolean indicating whether the player is paused
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: boolean
player?.isPaused();
**Returns: Boolean
player?.isPaused
Returns: Bool
player?.isPaused()
Returns: boolean
player.callFunc("isPaused");
getVideoType()
Returns the type of video ("VOD" or "LIVE")
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: lura.unified.VideoType
player?.getVideoType();
**Returns: LuraVideoType
player?.videoType
Returns: "VOD" | "LIVE"
player?.getVideoType()
Returns: lura.unified.VideoType
player.callFunc("getVideoType");
getMediaFormat()
Returns the format of the media (e.g. "DASH", "HLS")
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: lura.unified.MediaFormat
player?.getMediaFormat();
Returns: LuraMediaFormat
player?.mediaFormat
Returns: LuraMediaFormat
player?.getMediaFormat()
Returns: lura.unified.MediaFormat
player.callFunc("getMediaFormat");
getPlaybackSpeed()
Returns the playback speed
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: number
player?.getPlaybackSpeed();
Returns: Float
player?.playbackSpeed
Returns: Double
player?.getPlaybackSpeed()
Returns: float
player.callFunc("getPlaybackSpeed");
setPlaybackSpeed(speed)
Sets the playback speed between 0.1 and 16
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
speed number | Playback speed value you want to set |
Returns: void
player?.setPlaybackSpeed(speed);
Value | Description |
---|---|
speed Float | Playback speed value you want to set |
Returns: void
player?.playbackSpeed = speed
Value | Description |
---|---|
speed Double | Playback speed value you want to set |
Returns: void
player?.setPlaybackSpeed(speed)
Value | Description |
---|---|
speed float | Playback speed value you want to set |
Returns: invalid
player.callFunc("setPlaybackSpeed", speed);
getVolume()
Returns the current volume of the player
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: number
player?.getVolume();
Returns: Float
player?.volume
Returns: Double
player?.getVolume()
Returns: float
player.callFunc("getVolume");
setVolume(volume)
Sets the volume of the player to the given value
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
volume number | A value between 0 and 1 |
Returns: void
player?.setVolume(volume);
Value | Description |
---|---|
volume Float | A value between 0.0f and 1.0f |
Returns: void
player?.volume = volume
Value | Description |
---|---|
volume Double | A value between 0 and 1 |
Returns: void
player?.setVolume(volume)
isMuted()
Returns a boolean indicating whether the player is muted
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: boolean
player?.isMuted();
Returns: Boolean
player?.isMuted
Returns: Bool
player?.isMuted()
Returns: boolean
player.callFunc("isMuted");
setMuted(muted)
Sets the muted setting of the player to the given value
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
muted boolean | Whether you want the video to be muted or not |
Returns: void
player?.setMuted(muted);
Value | Description |
---|---|
muted Boolean | Whether you want the video to be muted or not |
Returns: void
player?.setMuted(muted)
Value | Description |
---|---|
muted Bool | Whether you want the video to be muted or not |
Returns: void
player?.setMuted(muted)
Value | Description |
---|---|
muted boolean | Whether you want the video to be muted or not |
Returns: void
player.callFunc("setMuted", muted);
getScreenState()
Returns the screen state, whether it should be picture in picture, fullscreen or windowed.
- Javascript
- Kotlin
- Swift
Returns: lura.unified.ScreenState
player?.getScreenState();
Returns: LuraScreenState
player?.getScreenState()
Returns: LuraScreenState
player?.getScreenState()
setScreenState(state)
Sets the screen state, whether it should be picture in picture, fullscreen or windowed.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
state lura.unified.ScreenState | Current screen state |
Returns: void
player?.setScreenState(state);
Value | Description |
---|---|
state LuraScreenState | Current screen state |
Returns: void
player?.setScreenState(state = state)
Value | Description |
---|---|
state LuraScreenState | Current screen state |
Returns: void
player?.setScreenState(state: state)
getDuration()
Returns video duration in seconds
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: number
player?.getDuration();
Returns: Float
player?.duration
Returns: Double
player?.getDuration()
Returns: float
player.callFunc("getDuration");
seek(time)
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.
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
time number | Time in seconds that you want to seek to. For live streams, unix timestamp in seconds. |
Returns: void
player?.seek(time);
Seeks to a specific time (milliseconds)
Value | Description |
---|---|
time Long | Time in seconds that you want to seek to. |
Returns: void
player?.seek(time)
Value | Description |
---|---|
time Double | Time in seconds that you want to seek to. |
Returns: void
player?.seek(time)
Value | Description |
---|---|
time float | Time in seconds that you want to seek to. |
Returns: invalid
player.callFunc("seek", time);
catchLive()
Seeks to the end of the seekable range in live videos.
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: void
player?.catchLive();
Returns: void
player?.catchLive()
Returns: void
player?.catchLive()
Returns: invalid
player.callFunc("catchLive");
getLivePosition()
Returns the live position in live streams
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: number
player?.getLivePosition();
Returns: Long
player?.liveOffset
Returns: Double
player?.getLivePosition()
Returns: float
player.callFunc("getLivePosition");
getBufferedDuration()
Returns buffered duration
- Javascript
- Kotlin
- Swift
Returns: number
player?.getBufferedDuration();
Returns: Long
player?.getBufferedDuration()
Returns: Double
player?.getBufferedDuration()
getBufferedStart()
Returns buffered start
- Javascript
- Kotlin
- Swift
Returns: number
player?.getBufferedStart();
Returns: Long
player?.getBufferedStart()
Returns: Double
player?.getBufferedStart()
getBufferedEnd()
Returns buffered end
- Javascript
- Kotlin
- Swift
Returns: number
player?.getBufferedEnd();
Returns: Long
player?.getBufferedEnd()
Returns: Double
player?.getBufferedEnd()
getCurrentTime()
Returns current playback time
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: number
player?.getCurrentTime();
Returns: Long
player?.currentTime
Returns: Double
player?.getCurrentTime()
Returns: float
player.callFunc("getCurrentTime");
requestTrickPlayImage(time, desiredWidth)
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.
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
time number | Presentation time of the trick play image that you want to request. |
desiredWidth number | Desired width of the trick play image. |
Returns: void
player?.requestTrickPlayImage(time, desiredWidth);
Value | Description |
---|---|
time Long | Presentation time of the trick play image that you want to request. |
desiredWidth Float | Desired width of the trick play image. |
Returns: Bitmap?
val bitmap = player?.requestTrickPlayImage(time, desiredWidth);
Value | Description |
---|---|
time Double | Presentation time of the trick play image that you want to request. |
desiredWidth Double | Desired width of the trick play image. |
Returns: void
player?.requestTrickPlayImage(time, desiredWidth)
Value | Description |
---|---|
time float | Presentation time of the trick play image that you want to request. |
Returns: invalid
player.callFunc("requestTrickPlayImage", time);
getTrickPlayInformation()
Returns the trick play information available in the player.
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: Array<{width: number, height: number}>
player?.getTrickPlayInformation();
Returns: List<LuraTrickPlayInformation>
player?.getTrickPlayInformation();
Returns: [[width: Double, height: Double]]
player?.getTrickPlayInformation()
Returns: Array<{width: number, height: number}>
player.callFunc("getTrickPlayInformation");
getAvailabilityWindows()
Returns the available seekable ranges in a live stream.
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: lura.unified.AvailabilityWindow[]
player?.getAvailabilityWindows();
Returns: List<LuraAvailabilityWindow>
player?.getAvailabilityWindows()
Returns: [AvailabilityWindow]
player?.getAvailabilityWindows()
Returns: lura.unified.AvailabilityWindow[]
player.callFunc("getAvailabilityWindows");
Playlist Methods
getPlaylistItems()
Returns the items from the playlist configuration.
- Javascript
- Kotlin
- Swift
Returns: Array<lura.unified.Configuration>
player?.getPlaylistItems();
Returns: List<LuraConfiguration>
player?.getPlaylistItems
Returns: [LuraPlayerConfiguration]
player?.getPlaylistItems()
getPlaylistItem(index)
Returns the item at the given index or null if not exists.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
index number | Index of the playlist item that you want to get. |
Returns: lura.unified.Configuration
player?.getPlaylistItem(index);
Value | Description |
---|---|
index Int | Index of the playlist item that you want to get. |
Returns: LuraConfiguration
player?.getPlaylistItem(index)
Value | Description |
---|---|
index Int | Index of the playlist item that you want to get. |
Returns: LuraPlayerConfiguration
player?.getPlaylistItem(index)
updatePlaylistItem(item, index)
Updates the playlist item at the given index.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
item lura.unified.Configuration | New playlist item that you have updated. |
index number | Index of the playlist item that you want to update. |
Returns: void
player?.updatePlaylistItem(item, index);
Value | Description |
---|---|
item LuraConfiguration | New playlist item that you have updated. |
index Int | Index of the playlist item that you want to update. |
Returns: void
player?.updatePlaylistItem(item, index)
Value | Description |
---|---|
item LuraPlayerConfiguration | New playlist item that you have updated. |
index Int | Index of the playlist item that you want to update. |
Returns: void
player?.updatePlaylistItem(item, index)
removePlaylistItem(index)
Removes the playlist item at the given index.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
index number | Index of the playlist item that you want to remove. |
Returns: void
player?.removePlaylistItem(index);
Value | Description |
---|---|
index Int | Index of the playlist item that you want to remove. |
Returns: void
player?.removePlaylistItem(index)
Value | Description |
---|---|
index Int | Index of the playlist item that you want to remove. |
Returns: void
player?.removePlaylistItem(index)
addPlaylistItem(item, index)
Adds a playlist item to the given index. If index is not provided, playlist item will be added as the last item.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
item lura.unified.Configuration | New playlist item that you want to insert. |
index number | null | Index of the playlist item that you want to add. |
Returns: void
player?.addPlaylistItem(item, index);
Value | Description |
---|---|
item LuraConfiguration | New playlist item that you want to insert. |
index Int | null | Index of the playlist item that you want to add. |
Returns: void
player?.addPlaylistItem(item, index)
Value | Description |
---|---|
item LuraPlayerConfiguration | New playlist item that you want to insert. |
index Int | nil | Index of the playlist item that you want to add. |
Returns: void
player?.addPlaylistItem(item, index)
getCurrentPlaylistItemIndex()
Returns the index of the currently playing playlist item.
- Javascript
- Kotlin
- Swift
Returns: number
player?.getCurrentPlaylistItemIndex();
Returns: Int?
player?.getCurrentPlaylistItemIndex()
Returns: Int?
player?.getCurrentPlaylistItemIndex()
setPlaylistRepeat(repeat)
Sets the value for whether the playlist should run in repeat mode or not.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
repeat boolean | Whether the playlist should run in a loop or not. |
Returns: void
player?.setPlaylistRepeat(repeat);
Value | Description |
---|---|
repeat Bool | Whether the playlist should run in a loop or not. |
Returns: void
player?.setPlaylistRepeat(repeat)
Value | Description |
---|---|
repeat Bool | Whether the playlist should run in a loop or not. |
Returns: void
player?.setPlaylistRepeat(repeat)
loadPlaylistItem(index)
Loads the playlist item configuration with the given index if exists.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
index number | Index of the playlist item that you want to play. |
Returns: void
player?.loadPlaylistItem(index);
Value | Description |
---|---|
index Int | Index of the playlist item that you want to play. |
Returns: void
player?.loadPlaylistItem(index)
Value | Description |
---|---|
index Int | Index of the playlist item that you want to play. |
Returns: void
player?.loadPlaylistItem(index)
loadNextPlaylistItem()
Loads the next item in the playlist. Will play the first item if this method is called at the last playlist item.
- Javascript
- Kotlin
- Swift
Returns: void
player?.loadNextPlaylistItem();
Returns: void
player?.loadNextPlaylistItem()
Returns: void
player?.loadNextPlaylistItem()
loadPreviousPlaylistItem()
Loads the previous item in the playlist. Will play the last item if this method is called at the first playlist item.
- Javascript
- Kotlin
- Swift
Returns: void
player?.loadPreviousPlaylistItem();
Returns: void
player?.loadPreviousPlaylistItem()
Returns: void
player?.loadPreviousPlaylistItem()
setPlaylistAutoSwitchMechanism(autoSwitch)
Enable/disable the automatic switching mechanism in between playlist items.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
autoSwitch boolean | Whether auto switching mechanism should be enabled or not. |
Returns: void
player?.setPlaylistAutoSwitchMechanism(autoSwitch);
Value | Description |
---|---|
autoSwitch Bool | Whether auto switching mechanism should be enabled or not. |
Returns: void
player?.setPlaylistAutoSwitchMechanism(autoSwitch)
Value | Description |
---|---|
autoSwitch Bool | Whether auto switching mechanism should be enabled or not. |
Returns: void
player?.setPlaylistAutoSwitchMechanism(autoSwitch)
abortPlaylistAutoSwitch()
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.
- Javascript
- Kotlin
- Swift
Returns: void
player?.abortPlaylistAutoSwitch();
Returns: void
player?.abortPlaylistAutoSwitch()
Returns: void
player?.abortPlaylistAutoSwitch()
updatePlayerView(newPlayerView)
Updating LuraPlayerView to new instance of it.
- Kotlin
- Swift
Value | Description |
---|---|
newPlayerView LuraPlayerView | New instance of LuraPlayerView. |
Returns: void
player?.updatePlayerView(newPlayerView = newPlayerView)
Value | Description |
---|---|
newPlayerView LuraPlayerView | New instance of LuraPlayerView. |
Returns: void
player?.updatePlayerView(newPlayerView: newPlayerView)
Ad Management Methods
getInterstitials()
Returns the interstitials
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: Array<lura.unified.AdBreak>
player?.getInterstitials();
Returns: List<LuraAdBreak>
player?.getIntersititals
Returns: ["breaks": [LuraAdBreak]]
player?.getInterstitials()
Returns: Array<lura.unified.AdBreak>
player.callFunc("getInterstitials");
skipAd()
Skips the current ad
- Javascript
- Kotlin
- Swift
- Brightscript
Returns: void
player?.skipAd();
Returns: void
player?.skipAd()
Returns: void
player?.skipAd()
Returns: invalid
player.callFunc("skipAd");
Event Methods
addListener(listener)
Sets the event listener of the Lura Player. Returns an id for removing the listener.
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
listener (e: lura.unified.UnifiedEvent<k: lura.unified.UnifiedEventName> => void | The 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);
Value | Description |
---|---|
dispatcher CoroutineDispatcher | The coroutine dispatcher can confine coroutine execution to a specific thread, dispatch it to a thread pool, or let it run unconfined. |
listener LuraEventListener | The listener function when the event is dispatched |
Returns: String
player?.addListener(Dispatchers.Main) { event: LuraEvent ->
when (event.type) {
LuraEventType.CONFIGURED -> {}
else -> {}
}
}
Value | Description |
---|---|
listener @escaping LuraEventListener | The listener function when the event is dispatched |
Returns: String
var luraListener: LuraEventListener = { [weak self] eventBundle in
switch eventBundle.event {
case .CONFIGURED:
// DO SOMETHING
return
default:
return
}
}
player?.addListener(listener: luraListener)
Returns: invalid
player.events.observeField("CONFIGURED", "onConfigured")
player.events.observeField("PLAYING", "onPlaying")
player.events.observeField(<SOME_OTHER_EVENT>, "myHandler")
removeListener(listener)
Removes the event listener from the Lura Player.
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
listener string | The id of the listener function from addListener |
Returns: void
player?.removeListener(listener);
Value | Description |
---|---|
listener String | The id of the listener function from addListener |
Returns: void
player?.removeListener(listener)
Value | Description |
---|---|
listener String | The id of the listener function from addListener |
Returns: void
player?.removeListener(listener)
Returns: invalid
player.events.unobserveField("CONFIGURED", "onConfigured")
player.events.unobserveField("PLAYING", "onPlaying")
player.events.unobserveField(<SOME_OTHER_EVENT>, "myHandler")
Cast Management Methods
requestCasting(castTarget)
Requests casting to the selected target if available.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
castTarget lura.unified.CastTargets | The list of cast targets that can be used. |
Returns: void
player?.requestCasting(castTarget);
Value | Description |
---|---|
castTarget LuraCastTargets | The list of cast targets that can be used. |
Returns: void
player?.requestCasting(castTarget);
Value | Description |
---|---|
castTarget LuraCastTargets | The list of cast targets that can be used. |
Returns: void
player?.requestCasting(castTarget);
isCasting(castTarget)
Returns a value representing whether LuraPlayer is casting to a cast target or not.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
castTarget lura.unified.CastTargets | The list of cast targets that can be used. |
Returns: boolean
player?.isCasting(castTarget);
Value | Description |
---|---|
castTarget LuraCastTargets | The list of cast targets that can be used. |
Returns: Boolean
player?.isCasting(castTarget);
Value | Description |
---|---|
castTarget LuraCastTargets | The list of cast targets that can be used. |
Returns: bool
player?.isCasting(castTarget);
exitCasting(castTarget)
Ends or tries to end the casting of the cast target.
- Javascript
- Kotlin
- Swift
Value | Description |
---|---|
castTarget lura.unified.CastTargets | The list of cast targets that can be used. |
Returns: void
player?.exitCasting(castTarget);
Value | Description |
---|---|
castTarget LuraCastTargets | The list of cast targets that can be used. |
Returns: void
player?.exitCasting(castTarget);
Value | Description |
---|---|
castTarget LuraCastTargets | The list of cast targets that can be used. |
Returns: void
player?.exitCasting(castTarget);
getCastingAvailability()
Returns the availability of the casting targets.
- Javascript
- Kotlin
- Swift
Returns: {[key in
lura.unified.CastTargets
]?: boolean}
player?.getCastingAvailability();
Returns: Map<LuraCastTargets, Boolean>
player?.getCastingAvailability();
Returns: [LuraCastTargets: Bool]
player?.getCastingAvailability();
Miscellaneous
setCustomData(key, value)
Sends custom data through the CUSTOM_DATA_CHANGED event.
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
key string | Key of the custom data |
value any | Value of the custom data. |
Returns: void
player?.setCustomData(key, value);
Value | Description |
---|---|
key String | Key of the custom data |
value Any | Value of the custom data. |
Returns: void
player?.setCustomData(key, value);
Value | Description |
---|---|
key String | Key of the custom data |
value Any | Value of the custom data. |
Returns: void
player?.setCustomData(key, value);
Value | Description |
---|---|
key string | Key of the custom data |
value any | Value of the custom data. |
Returns: invalid
player.callFunc("setCustomData", key, value);
getCustomData(key)
Gets the custom data for the given key.
- Javascript
- Kotlin
- Swift
- Brightscript
Value | Description |
---|---|
key string | Key of the custom data. |
Returns: Any
player?.getCustomData(key);
Value | Description |
---|---|
key String | Key of the custom data. |
Returns: Any
player?.getCustomData(key);
Value | Description |
---|---|
key String | Key of the custom data. |
Returns: Any
player?.getCustomData(key);
Value | Description |
---|---|
key string | Key of the custom data. |
Returns: any
player.callFunc("getCustomData", key);
getTimeUpdateData()
Returns the TIME_UPDATED
event payload for the current time.
- Javascript
- Kotlin
- Swift
- Brightscript
player?.getTimeUpdateData();
player?.getTimeUpdateData();
player?.getTimeUpdateData();
player.callFunc("getTimeUpdateData");
Old Methods
requestFullscreen()
Deprecated, please use setScreenState
Requests fullscreen mode for the player
Returns: void
player?.requestFullscreen();
exitFullscreen()
Deprecated, please use setScreenState
Requests exiting the fullscreen mode for the player
Returns: void
player?.exitFullscreen();
isFullscreen()
Deprecated, please use getScreenState
Returns whether the player is in fullscreen mode or not.
Returns: boolean
player?.isFullscreen();
requestPictureInPicture()
Deprecated, please use setScreenState
Requests Picture-in-Picture mode
Returns: void
player?.requestPictureInPicture();
exitPictureInPicture()
Deprecated, please use setScreenState
Exits Picture-in-Picture mode
Returns: void
player?.exitPictureInPicture();
isPictureInPicture()
Deprecated, please use getScreenState
Returns whether the player is in picture in picture mode or not.
Returns: boolean
player?.isPictureInPicture();