feat: add onVolumeChange event (#3322)

* feat: implement `onVolumeChange` event
This commit is contained in:
Krzysztof Moch
2023-11-04 18:11:54 +01:00
committed by GitHub
parent 50e0b33bf6
commit cdbc856387
10 changed files with 71 additions and 1 deletions

View File

@@ -82,6 +82,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
onFullscreenPlayerDidDismiss,
onReadyForDisplay,
onPlaybackRateChange,
onVolumeChange,
onAudioBecomingNoisy,
onPictureInPictureStatusChanged,
onRestoreUserInterfaceForPictureInPictureStop,
@@ -344,6 +345,13 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
[onPlaybackRateChange],
);
const _onVolumeChange = useCallback(
(e: NativeSyntheticEvent<Readonly<{volume: number}>>) => {
onVolumeChange?.(e.nativeEvent);
},
[onVolumeChange],
);
const _onReadyForDisplay = useCallback(() => {
setShowPoster(false);
onReadyForDisplay?.();
@@ -509,6 +517,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
onAudioFocusChanged={_onAudioFocusChanged}
onReadyForDisplay={_onReadyForDisplay}
onPlaybackRateChange={_onPlaybackRateChange}
onVolumeChange={_onVolumeChange}
onVideoAudioBecomingNoisy={onAudioBecomingNoisy}
onPictureInPictureStatusChanged={_onPictureInPictureStatusChanged}
onRestoreUserInterfaceForPictureInPictureStop={