Skip to main content

Player Methods Reference

This section explains exposed methods from mutable React.RefObject .

import { useRef } from 'react';
import LuraPlayer from 'lura-react-native-core';


export default function MySampleComponent(){
const playerRef = useRef<LuraPlayer>(null);
const config = {
token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2aWQiOiI0MzY2NjIzIiwiaXNzIjoiM1FMWjdaV0JsRko1Vk16Y2pyczJPbTd3VTdEanIzNFkifQ.CruM1W3gIEyQTBTqfaY5gTdf7b_2SSNg4gj6JGOj4Mg"
};
...
playerRef.current?.play();
...
playerRef.current?.setVolume(0.3);
...

return (
<View>
<LuraPlayer ref={playerRef} config={config}/>
</View>
);
}
MethodParamsReturn TypeDescription
getCueManager-lura.interstitials.CueManagerReturns the cue manager of the player
getConfiguration-lura.configurations.ConfigDataReturns the configuration object of the player
updateConfigurationPartial<lura.configurations.ConfigData>voidUpdates the configuration object of the player with the given lura config object
getMetadata-lura.metadata.VideoMetadataReturns the metadata of the media
getAutoplay-booleanReturns the autoplay setting of the player
setAutoplaybooleanvoidSets the autoplay setting of the player to the given value
addEventListenertype: lura.enums.LuraPlayerEvents, callback: (e: lura.events.LuraEvent) => void, options?: lura.events.EventListenerOptionsvoidAdds an event listener to the player
dispatchEventlura.enums.LuraPlayerEventsvoidDispatches an event from the player
removeEventListenertype: lura.enums.LuraPlayerEvents, callback: (e: lura.events.LuraEvent) => voidvoidRemoves an event listener from the player
isContentEnded-booleanReturns a boolean indicating whether the media content has ended
getElement-HTMLElementReturns the HTML element of the player
getProvider-lura.providers.VirtualProviderReturns the media provider object of the player
getPreviewMatrix-lura.base.PreviewMatrixReturns the preview matrix of the media
addPluginlura.plugins.PluginvoidAdds a plugin to the player
getPlugins-Array<lura.plugins.Plugin>Returns an array of all plugins of the player
getOrCreatePluginlura.plugins.Pluginlura.plugins.PluginReturns the plugin with the given name or creates a new one
getPluginByNamestringlura.plugins.PluginReturns the plugin with the given name
getVideoType-lura.enums.LuraVideoTypeReturns the type of video ("VOD" or "LIVE")
getMediaFormat-lura.enums.LuraMediaFormatReturns the format of the media (e.g. "mp4", "m3u8-variant")
isPaused-booleanReturns a boolean indicating whether the player is paused
refresh-Promise<void>Refreshes the player
getVolume-numberReturns the current volume of the player
setVolumenumbervoidSets the volume of the player to the given value
setMutedbooleanvoidSets the muted setting of the player to the given value
isMuted-booleanReturns a boolean indicating whether the player is muted
getCaptionManager-lura.tracks.CaptionManagerReturns the caption manager of the player
getAudioManager-lura.tracks.AudioManagerReturns the audio manager of the player
requestFullscreen-voidRequests fullscreen mode for the player
requestPictureInPicture-voidRequests Picture-in-Picture mode for
getDuration-numberGets video duration
setPreferredKeySystemsstring[]voidSets preferred key systems
play-voidPlays the video
pause-voidPauses the video
isLive-booleanIndicates if the video is live
seeknumbervoidSeeks to a specific time (seconds)
catchLive-voidCatching live video
getLiveSyncPosition-numberGets live sync position
getNativeBufferedEnd-numberGets native buffered end
getBufferedEnd-numberGets buffered end
getNativeBufferedStart-numberGets native buffered start
getCurrentTime-numberGets current playback time
getBufferedStart-numberGets buffered start
skipAd-voidSkips the current ad
getAdBreakPositions-Array<number>Gets ad break positions
getPoster-stringGets the video poster
setPosterstringvoidSets the video poster
getPlaybackSpeed-numberGets the playback speed
setPlaybackSpeednumbervoidSets the playback speed
loadlura.configurations.ConfigDataPromise<void>Loads video source
destroy-voidDestroys the player
isLoading-booleanIndicates if player is loading
timeWithoutAdsnumbernumberGets time without ads (seconds)
timeWithAdsnumbernumberGets time with ads (seconds)