Skip to content

Commit

Permalink
Merge pull request #1 from hungvu193/feat/add-autohide-player-prop
Browse files Browse the repository at this point in the history
Add auto hide player props
  • Loading branch information
hungvu193 authored Nov 12, 2021
2 parents 33bcb0e + 77da80c commit a1aa6b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ declare const VideoPlayer: {
inFullscreen?: boolean | undefined;
visible?: boolean | undefined;
};
autoHidePlayer: true;
};
};
export default VideoPlayer;
26 changes: 13 additions & 13 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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* () {
Expand Down

0 comments on commit a1aa6b8

Please sign in to comment.