From 023c127ff8fb036a5e23897e2d49dd431b1d219c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=CC=81a=20DE=20AMORIN?= Date: Fri, 20 Jan 2023 13:35:53 +0100 Subject: [PATCH 1/7] feat: add showOnEnd prop to show controls on video ending --- src/VideoPlayer.tsx | 2 ++ src/types.ts | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/VideoPlayer.tsx b/src/VideoPlayer.tsx index 232490a..39977c6 100644 --- a/src/VideoPlayer.tsx +++ b/src/VideoPlayer.tsx @@ -29,6 +29,7 @@ export const VideoPlayer = (props: VideoPlayerProps) => { resizeMode = 'contain', isFullscreen = false, showOnStart = false, + showOnEnd = false, paused = false, muted = false, volume = 1, @@ -125,6 +126,7 @@ export const VideoPlayer = (props: VideoPlayerProps) => { if (currentTime < duration) { setCurrentTime(duration); setPaused(true); + if(showOnEnd) setShowControls(true) } if (typeof onEnd === 'function') { onEnd(); diff --git a/src/types.ts b/src/types.ts index f746fb3..9b578fc 100644 --- a/src/types.ts +++ b/src/types.ts @@ -55,6 +55,13 @@ export interface VideoPlayerProps extends VideoProperties { */ showOnStart?: boolean; + /** + * Show or hide the controls on end + * + * @default false + */ + showOnEnd?: boolean; + /** * Title of the video */ From 0a94feff4724147b295aad20e7f2e680f9dbc6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=CC=81a=20DE=20AMORIN?= Date: Fri, 20 Jan 2023 13:39:00 +0100 Subject: [PATCH 2/7] feat: add showOnEnd prop to show controls on video ending --- src/VideoPlayer.tsx | 2 ++ src/types.ts | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/VideoPlayer.tsx b/src/VideoPlayer.tsx index 232490a..39977c6 100644 --- a/src/VideoPlayer.tsx +++ b/src/VideoPlayer.tsx @@ -29,6 +29,7 @@ export const VideoPlayer = (props: VideoPlayerProps) => { resizeMode = 'contain', isFullscreen = false, showOnStart = false, + showOnEnd = false, paused = false, muted = false, volume = 1, @@ -125,6 +126,7 @@ export const VideoPlayer = (props: VideoPlayerProps) => { if (currentTime < duration) { setCurrentTime(duration); setPaused(true); + if(showOnEnd) setShowControls(true) } if (typeof onEnd === 'function') { onEnd(); diff --git a/src/types.ts b/src/types.ts index f746fb3..9b578fc 100644 --- a/src/types.ts +++ b/src/types.ts @@ -55,6 +55,13 @@ export interface VideoPlayerProps extends VideoProperties { */ showOnStart?: boolean; + /** + * Show or hide the controls on end + * + * @default false + */ + showOnEnd?: boolean; + /** * Title of the video */ From ec4766bb860bd8f57d962cedeab5fb4f7fb6b8f4 Mon Sep 17 00:00:00 2001 From: Ovidiu Cristescu <55203625+criszz77@users.noreply.github.com> Date: Fri, 20 Jan 2023 19:25:35 +0200 Subject: [PATCH 3/7] fix eslint --- src/VideoPlayer.tsx | 6 +++++- src/types.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/VideoPlayer.tsx b/src/VideoPlayer.tsx index 39977c6..d896b53 100644 --- a/src/VideoPlayer.tsx +++ b/src/VideoPlayer.tsx @@ -126,8 +126,12 @@ export const VideoPlayer = (props: VideoPlayerProps) => { if (currentTime < duration) { setCurrentTime(duration); setPaused(true); - if(showOnEnd) setShowControls(true) + + if (showOnEnd) { + setShowControls(true); + } } + if (typeof onEnd === 'function') { onEnd(); } diff --git a/src/types.ts b/src/types.ts index 9b578fc..6838ae0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -56,7 +56,7 @@ export interface VideoPlayerProps extends VideoProperties { showOnStart?: boolean; /** - * Show or hide the controls on end + * Show or hide the controls on end of video * * @default false */ From 85ed1824a33b32739f441f3002d85713654cfbc0 Mon Sep 17 00:00:00 2001 From: Ovidiu Cristescu <55203625+criszz77@users.noreply.github.com> Date: Fri, 20 Jan 2023 19:25:47 +0200 Subject: [PATCH 4/7] update README.md --- README.md | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 5ea5900..81703e9 100644 --- a/README.md +++ b/README.md @@ -75,24 +75,25 @@ You can pass any of the props that the `