feat: add getCurrentPosition to component's ref (#3824)

* feat: add getCurrentPosition to component's ref
---------

Co-authored-by: mostafahasani <hasanie.mostafa@alopeyk.com>
This commit is contained in:
Seyed Mostafa Hasani
2024-05-28 02:00:38 -07:00
committed by GitHub
parent e23e02b359
commit c7f4d7b83b
8 changed files with 56 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ export interface VideoRef {
) => void;
save: (options: object) => Promise<VideoSaveData>;
setVolume: (volume: number) => void;
getCurrentPosition: () => Promise<number>;
}
const Video = forwardRef<VideoRef, ReactVideoProps>(
@@ -295,6 +296,10 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
return VideoManager.setVolume(volume, getReactTag(nativeRef));
}, []);
const getCurrentPosition = useCallback(() => {
return VideoManager.getCurrentPosition(getReactTag(nativeRef));
}, []);
const onVideoLoadStart = useCallback(
(e: NativeSyntheticEvent<OnLoadStartData>) => {
hasPoster && setShowPoster(true);
@@ -512,6 +517,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
resume,
restoreUserInterfaceForPictureInPictureStopCompleted,
setVolume,
getCurrentPosition,
}),
[
seek,
@@ -522,6 +528,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
resume,
restoreUserInterfaceForPictureInPictureStopCompleted,
setVolume,
getCurrentPosition,
],
);

View File

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