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>
);
}
| Method | Params | Return Type | Description |
|---|---|---|---|
| getCueManager | - | lura.interstitials.CueManager | Returns the cue manager of the player |
| getConfiguration | - | lura.configurations.ConfigData | Returns the configuration object of the player |
| updateConfiguration | Partial<lura.configurations.ConfigData> | void | Updates the configuration object of the player with the given lura config object |
| getMetadata | - | lura.metadata.VideoMetadata | Returns the metadata of the media |
| getAutoplay | - | boolean | Returns the autoplay setting of the player |
| setAutoplay | boolean | void | Sets the autoplay setting of the player to the given value |
| addEventListener | type: lura.enums.LuraPlayerEvents, callback: (e: lura.events.LuraEvent) => void, options?: lura.events.EventListenerOptions | void | Adds an event listener to the player |
| dispatchEvent | lura.enums.LuraPlayerEvents | void | Dispatches an event from the player |
| removeEventListener | type: lura.enums.LuraPlayerEvents, callback: (e: lura.events.LuraEvent) => void | void | Removes an event listener from the player |
| isContentEnded | - | boolean | Returns a boolean indicating whether the media content has ended |
| getElement | - | HTMLElement | Returns the HTML element of the player |
| getProvider | - | lura.providers.VirtualProvider | Returns the media provider object of the player |
| getPreviewMatrix | - | lura.base.PreviewMatrix | Returns the preview matrix of the media |
| addPlugin | lura.plugins.Plugin | void | Adds a plugin to the player |
| getPlugins | - | Array<lura.plugins.Plugin> | Returns an array of all plugins of the player |
| getOrCreatePlugin | lura.plugins.Plugin | lura.plugins.Plugin | Returns the plugin with the given name or creates a new one |
| getPluginByName | string | lura.plugins.Plugin | Returns the plugin with the given name |
| getVideoType | - | lura.enums.LuraVideoType | Returns the type of video ("VOD" or "LIVE") |
| getMediaFormat | - | lura.enums.LuraMediaFormat | Returns the format of the media (e.g. "mp4", "m3u8-variant") |
| isPaused | - | boolean | Returns a boolean indicating whether the player is paused |
| refresh | - | Promise<void> | Refreshes the player |
| getVolume | - | number | Returns the current volume of the player |
| setVolume | number | void | Sets the volume of the player to the given value |
| setMuted | boolean | void | Sets the muted setting of the player to the given value |
| isMuted | - | boolean | Returns a boolean indicating whether the player is muted |
| getCaptionManager | - | lura.tracks.CaptionManager | Returns the caption manager of the player |
| getAudioManager | - | lura.tracks.AudioManager | Returns the audio manager of the player |
| requestFullscreen | - | void | Requests fullscreen mode for the player |
| requestPictureInPicture | - | void | Requests Picture-in-Picture mode for |
| getDuration | - | number | Gets video duration |
| setPreferredKeySystems | string[] | void | Sets preferred key systems |
| play | - | void | Plays the video |
| pause | - | void | Pauses the video |
| isLive | - | boolean | Indicates if the video is live |
| seek | number | void | Seeks to a specific time (seconds) |
| catchLive | - | void | Catching live video |
| getLiveSyncPosition | - | number | Gets live sync position |
| getNativeBufferedEnd | - | number | Gets native buffered end |
| getBufferedEnd | - | number | Gets buffered end |
| getNativeBufferedStart | - | number | Gets native buffered start |
| getCurrentTime | - | number | Gets current playback time |
| getBufferedStart | - | number | Gets buffered start |
| skipAd | - | void | Skips the current ad |
| getAdBreakPositions | - | Array<number> | Gets ad break positions |
| getPoster | - | string | Gets the video poster |
| setPoster | string | void | Sets the video poster |
| getPlaybackSpeed | - | number | Gets the playback speed |
| setPlaybackSpeed | number | void | Sets the playback speed |
| load | lura.configurations.ConfigData | Promise<void> | Loads video source |
| destroy | - | void | Destroys the player |
| isLoading | - | boolean | Indicates if player is loading |
| timeWithoutAds | number | number | Gets time without ads (seconds) |
| timeWithAds | number | number | Gets time with ads (seconds) |