chore: add setFullScreen to component's ref (#3855)

* chore: add setFullScreen to component's ref and remove presentFullscreenPlayer & dismissFullscreenPlayer
This commit is contained in:
Seyed Mostafa Hasani
2024-06-11 00:11:26 +03:30
committed by GitHub
parent 016fca8a2a
commit 3a4a13011a
9 changed files with 56 additions and 19 deletions

View File

@@ -66,6 +66,7 @@ export interface VideoRef {
save: (options: object) => Promise<VideoSaveData>;
setVolume: (volume: number) => void;
getCurrentPosition: () => Promise<number>;
setFullScreen: (fullScreen: boolean) => void;
}
const Video = forwardRef<VideoRef, ReactVideoProps>(
@@ -300,6 +301,10 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
return VideoManager.getCurrentPosition(getReactTag(nativeRef));
}, []);
const setFullScreen = useCallback((fullScreen: boolean) => {
return VideoManager.setFullScreen(fullScreen, getReactTag(nativeRef));
}, []);
const onVideoLoadStart = useCallback(
(e: NativeSyntheticEvent<OnLoadStartData>) => {
hasPoster && setShowPoster(true);
@@ -518,6 +523,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
restoreUserInterfaceForPictureInPictureStopCompleted,
setVolume,
getCurrentPosition,
setFullScreen,
}),
[
seek,
@@ -529,6 +535,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
restoreUserInterfaceForPictureInPictureStopCompleted,
setVolume,
getCurrentPosition,
setFullScreen,
],
);

View File

@@ -391,6 +391,7 @@ export interface VideoManagerType {
) => Promise<void>;
setVolume: (volume: number, reactTag: number) => Promise<void>;
getCurrentPosition: (reactTag: number) => Promise<number>;
setFullScreen: (fullScreen: boolean, reactTag: number) => Promise<void>;
}
export interface VideoDecoderPropertiesType {