From 28f65b0a05bc85607dc6f3e98cd36f3e8bd60d60 Mon Sep 17 00:00:00 2001 From: Hans Date: Fri, 12 Nov 2021 10:58:00 +0700 Subject: [PATCH 1/2] Update index.d.ts --- dist/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/index.d.ts b/dist/index.d.ts index d818732..92116dd 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -40,6 +40,7 @@ declare const VideoPlayer: { inFullscreen?: boolean | undefined; visible?: boolean | undefined; }; + autoHidePlayer: true; }; }; export default VideoPlayer; From 77da80c1fb8bdbdfba24069fb8bc3de25eef87b3 Mon Sep 17 00:00:00 2001 From: Hans Date: Fri, 12 Nov 2021 10:59:39 +0700 Subject: [PATCH 2/2] Update index.js --- dist/index.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/dist/index.js b/dist/index.js index f3b6505..3f70c68 100644 --- a/dist/index.js +++ b/dist/index.js @@ -78,20 +78,20 @@ const VideoPlayer = (tempProps) => { else if (controlsState === ControlStates.Visible) { hideAnimation(); } - // Prevent auto hide animation -// if (controlsTimer === null) { -// controlsTimer = setTimeout(() => { -// if (playbackInstanceInfo.state === PlaybackStates.Playing && -// controlsState === ControlStates.Hidden) { -// hideAnimation(); -// } -// if (controlsTimer) { -// clearTimeout(controlsTimer); -// } -// controlsTimer = null; -// }, 2000); + if (controlsTimer === null && props.autoHidePlayer) { + controlsTimer = setTimeout(() => { + if (playbackInstanceInfo.state === PlaybackStates.Playing && + controlsState === ControlStates.Hidden) { + hideAnimation(); + } + if (controlsTimer) { + clearTimeout(controlsTimer); + } + controlsTimer = null; + }, 2000); -// } + } + }; }; // Set audio mode to play even in silent mode (like the YouTube app) const setAudio = () => __awaiter(void 0, void 0, void 0, function* () {