feat(android): add onControlsVisiblityChange (#3925)

* Adding onControlsVisiblityChange for Android
This commit is contained in:
Ash Mish
2024-06-22 02:15:21 -07:00
committed by GitHub
parent 104ee703ba
commit c2ce372bcf
6 changed files with 56 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ import NativeVideoComponent, {
type OnAudioTracksData,
type OnBandwidthUpdateData,
type OnBufferData,
type OnControlsVisibilityChange,
type OnExternalPlaybackChangeData,
type OnGetLicenseData,
type OnLoadStartData,
@@ -91,6 +92,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
onEnd,
onBuffer,
onBandwidthUpdate,
onControlsVisibilityChange,
onExternalPlaybackChange,
onFullscreenPlayerWillPresent,
onFullscreenPlayerDidPresent,
@@ -482,6 +484,13 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
[onAspectRatio],
);
const _onControlsVisibilityChange = useCallback(
(e: NativeSyntheticEvent<OnControlsVisibilityChange>) => {
onControlsVisibilityChange?.(e.nativeEvent);
},
[onControlsVisibilityChange],
);
const useExternalGetLicense = drm?.getLicense instanceof Function;
const onGetLicense = useCallback(
@@ -639,6 +648,9 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
? (_onReceiveAdEvent as (e: NativeSyntheticEvent<object>) => void)
: undefined
}
onControlsVisibilityChange={
onControlsVisibilityChange ? _onControlsVisibilityChange : undefined
}
/>
{hasPoster && showPoster ? (
<Image style={posterStyle} source={{uri: poster}} />