Expose onVideoSeekComplete event in React Native interface
Some checks failed
Build iOS / Build iOS Example App (pull_request) Has been cancelled
Build iOS / Build iOS Example App With Ads (pull_request) Has been cancelled
Build iOS / Build iOS Example App With Caching (pull_request) Has been cancelled
Check CLang / CLang-Format (pull_request) Has been cancelled
Check iOS / Swift-Lint (pull_request) Has been cancelled
Check iOS / Swift-Format (pull_request) Has been cancelled
Check JS / Check TS (tsc) (pull_request) Has been cancelled
Check JS / Lint JS (eslint, prettier) (pull_request) Has been cancelled

This commit is contained in:
Kat Huang 2024-08-05 14:24:38 -06:00
parent 18a0d234dd
commit eca4ba96f0
3 changed files with 17 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import type {
OnPlaybackStateChangedData, OnPlaybackStateChangedData,
OnProgressData, OnProgressData,
OnSeekData, OnSeekData,
OnSeekCompleteData,
OnTextTrackDataChangedData, OnTextTrackDataChangedData,
OnTimedMetadataData, OnTimedMetadataData,
OnVideoAspectRatioData, OnVideoAspectRatioData,
@ -90,6 +91,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
onError, onError,
onProgress, onProgress,
onSeek, onSeek,
onSeekComplete,
onEnd, onEnd,
onBuffer, onBuffer,
onBandwidthUpdate, onBandwidthUpdate,
@ -385,6 +387,13 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
[onSeek], [onSeek],
); );
const onVideoSeekComplete = useCallback(
(e: NativeSyntheticEvent<OnSeekCompleteData>) => {
onSeekComplete?.(e.nativeEvent);
},
[onSeekComplete]
);
const onVideoPlaybackStateChanged = useCallback( const onVideoPlaybackStateChanged = useCallback(
(e: NativeSyntheticEvent<OnPlaybackStateChangedData>) => { (e: NativeSyntheticEvent<OnPlaybackStateChangedData>) => {
onPlaybackStateChanged?.(e.nativeEvent); onPlaybackStateChanged?.(e.nativeEvent);
@ -716,6 +725,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
onVideoError={onError ? onVideoError : undefined} onVideoError={onError ? onVideoError : undefined}
onVideoProgress={onProgress ? onVideoProgress : undefined} onVideoProgress={onProgress ? onVideoProgress : undefined}
onVideoSeek={onSeek ? onVideoSeek : undefined} onVideoSeek={onSeek ? onVideoSeek : undefined}
onVideoSeekComplete={onSeekComplete ? onVideoSeekComplete : undefined}
onVideoEnd={onEnd} onVideoEnd={onEnd}
onVideoBuffer={onBuffer ? onVideoBuffer : undefined} onVideoBuffer={onBuffer ? onVideoBuffer : undefined}
onVideoPlaybackStateChanged={ onVideoPlaybackStateChanged={

View File

@ -182,6 +182,12 @@ export type OnSeekData = Readonly<{
seekTime: Float; seekTime: Float;
}>; }>;
export type OnVideoSeekCompleteData = Readonly<{
currentTime: number;
seekTime: number;
target: number;
}>;
export type OnPlaybackStateChangedData = Readonly<{ export type OnPlaybackStateChangedData = Readonly<{
isPlaying: boolean; isPlaying: boolean;
isSeeking: boolean; isSeeking: boolean;

View File

@ -258,6 +258,7 @@ export interface ReactVideoEvents {
onReceiveAdEvent?: (e: OnReceiveAdEventData) => void; //Android, iOS onReceiveAdEvent?: (e: OnReceiveAdEventData) => void; //Android, iOS
onRestoreUserInterfaceForPictureInPictureStop?: () => void; //iOS onRestoreUserInterfaceForPictureInPictureStop?: () => void; //iOS
onSeek?: (e: OnSeekData) => void; //Android, iOS, Windows UWP onSeek?: (e: OnSeekData) => void; //Android, iOS, Windows UWP
onSeekComplete?: (e: OnSeekCompleteData) -> void; // iOS
onPlaybackStateChanged?: (e: OnPlaybackStateChangedData) => void; // Android, iOS onPlaybackStateChanged?: (e: OnPlaybackStateChangedData) => void; // Android, iOS
onTimedMetadata?: (e: OnTimedMetadataData) => void; //Android, iOS onTimedMetadata?: (e: OnTimedMetadataData) => void; //Android, iOS
onAudioTracks?: (e: OnAudioTracksData) => void; // Android onAudioTracks?: (e: OnAudioTracksData) => void; // Android