import PlatformsList from '../../components/PlatformsList/PlatformsList.tsx'; # Methods This page shows the list of available methods ### `dismissFullscreenPlayer` `dismissFullscreenPlayer(): Promise` Take the player out of fullscreen mode. > [!WARNING] > deprecated, use setFullScreen method instead ### `pause` `pause(): Promise` Pause the video. ### `presentFullscreenPlayer` `presentFullscreenPlayer(): Promise` Put the player in fullscreen mode. On iOS, this displays the video in a fullscreen view controller with controls. On Android, this puts the navigation controls in fullscreen mode. It is not a complete fullscreen implementation, so you will still need to apply a style that makes the width and height match your screen dimensions to get a fullscreen video. > [!WARNING] > deprecated, use setFullScreen method instead ### `resume` `resume(): Promise` Resume the video. ### `restoreUserInterfaceForPictureInPictureStopCompleted` `restoreUserInterfaceForPictureInPictureStopCompleted(restored)` This function corresponds to the completion handler in Apple's [restoreUserInterfaceForPictureInPictureStop](https://developer.apple.com/documentation/avkit/avpictureinpicturecontrollerdelegate/1614703-pictureinpicturecontroller?language=objc). IMPORTANT: This function must be called after `onRestoreUserInterfaceForPictureInPictureStop` is called. ### `save` `save(): Promise<{ uri: string }>` Save video to your Photos with current filter prop. Returns promise. Notes: - Currently only supports highest quality export - Currently only supports MP4 export - Currently only supports exporting to user's cache directory with a generated UUID filename. - User will need to remove the saved video through their Photos app - Works with cached videos as well. (Checkout video-caching example) - If the video is has not began buffering (e.g. there is no internet connection) then the save function will throw an error. - If the video is buffering then the save function promise will return after the video has finished buffering and processing. Future: - Will support multiple qualities through options - Will support more formats in the future through options - Will support custom directory and file name through options ### `seek` `seek(seconds)` Seek to the specified position represented by seconds. seconds is a float value. `seek()` can only be called after the `onLoad` event has fired. Once completed, the [onSeek](./events#onseek) event will be called. #### Exact seek By default iOS seeks within 100 milliseconds of the target position. If you need more accuracy, you can use the seek with tolerance method: `seek(seconds, tolerance)` tolerance is the max distance in milliseconds from the seconds position that's allowed. Using a more exact tolerance can cause seeks to take longer. If you want to seek exactly, set tolerance to 0. ### `setVolume` `setVolume(value): Promise` This function will change the volume exactly like [volume](./props#volume) property. default value and range are the same then. ### `getCurrentPosition` `getCurrentPosition(): Promise` This function retrieves and returns the precise current position of the video playback, measured in seconds. This function will throw an error if player is not initialized. ### `setSource` `setSource(source: ReactVideoSource): Promise` This function will change the source exactly like [source](./props#source) property. Changing source with this function will overide source provided as props. ### `setFullScreen` `setFullScreen(fullscreen): Promise` If you set it to `true`, the player enters fullscreen mode. If you set it to `false`, the player exits fullscreen mode. On iOS, this displays the video in a fullscreen view controller with controls. On Android, this puts the navigation controls in fullscreen mode. It is not a complete fullscreen implementation, so you will still need to apply a style that makes the width and height match your screen dimensions to get a fullscreen video. ### `nativeHtmlVideoRef` A ref to the underlying html video element. This can be used if you need to integrate a 3d party, web only video library (like hls.js, shaka, video.js...). ### Example Usage ```tsx const videoRef = useRef(null); const someCoolFunctions = async () => { if (!videoRef.current) { return; } // present or dismiss fullscreen player videoRef.current.presentFullscreenPlayer(); videoRef.current.dismissFullscreenPlayer(); // pause or resume the video videoRef.current.pause(); videoRef.current.resume(); // save video to your Photos with current filter prop const response = await videoRef.current.save(); const path = response.uri; // seek to the specified position represented by seconds videoRef.current.seek(200); // or on iOS you can seek with tolerance videoRef.current.seek(200, 10); }; return (