From 2a57648ef0719e6673517ad82d1cf902c770c535 Mon Sep 17 00:00:00 2001 From: Sam Doyle Date: Wed, 25 Jan 2023 06:03:49 -0500 Subject: [PATCH] add "disableSeekButtons" property for hiding rewind/fast forward (#46) * add disableSeekForwardback property for hiding rewind/fast forward --- README.md | 1 + src/VideoPlayer.tsx | 2 ++ src/components/PlayPause/PlayPause.tsx | 34 +++++++++++++++++--------- src/types.ts | 8 ++++++ 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a589b1d..f505596 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ These are the various controls that you can turn on/off as needed. All of these | ----------------- | -------------------------- | | disableFullscreen | Hide the fullscreen button | | disablePlayPause | Hide the play/pause toggle and the rewind/forward buttons | +| disableSeekButtons | Hide the rewind/forward buttons (but not play/pause) | | disableSeekbar | Hide the seekbar | | disableVolume | Hide the Volume control | | disableTimer | Hide the timer | diff --git a/src/VideoPlayer.tsx b/src/VideoPlayer.tsx index 9ea04b3..5ea0ab2 100644 --- a/src/VideoPlayer.tsx +++ b/src/VideoPlayer.tsx @@ -64,6 +64,7 @@ export const VideoPlayer = (props: VideoPlayerProps) => { disableTimer = false, disableSeekbar = false, disablePlayPause = false, + disableSeekButtons = false, navigator, rewindTime = 15, } = props; @@ -420,6 +421,7 @@ export const VideoPlayer = (props: VideoPlayerProps) => { (); interface PlayPauseProps { animations: VideoAnimations; disablePlayPause: boolean; + disableSeekButtons: boolean; paused: boolean; togglePlayPause: () => void; resetControlTimeout: () => void; @@ -26,6 +27,7 @@ const forward = require('../../assets/img/forward.png'); export const PlayPause = ({ animations, disablePlayPause, + disableSeekButtons, paused, togglePlayPause, resetControlTimeout, @@ -48,12 +50,14 @@ export const PlayPause = ({ - - - + {!disableSeekButtons ? ( + + + + ) : null} - - - + {!disableSeekButtons ? ( + + + + ) : null} ); }; diff --git a/src/types.ts b/src/types.ts index 6838ae0..ab51aed 100644 --- a/src/types.ts +++ b/src/types.ts @@ -197,6 +197,14 @@ export interface VideoPlayerProps extends VideoProperties { * @default false */ disablePlayPause?: boolean; + + /** + * Hide the rewind/forward buttons without hiding the play/pause button + * + * @default false + */ + disableSeekButtons?: boolean; + /** * When using the default React Native navigator and do not override the `onBack` function, * you'll need to pass the navigator to the VideoPlayer for it to function