|
@@ -16,16 +16,18 @@ export const MinimizedPlayer = forwardRef<HTMLVideoElement, MiniVideoProps>(
|
|
({ isInView, author, title, ...videoPlayerProps }, ref) => {
|
|
({ isInView, author, title, ...videoPlayerProps }, ref) => {
|
|
const [forceExit, setForceExit] = useState(false)
|
|
const [forceExit, setForceExit] = useState(false)
|
|
const [isPaused, setIsPaused] = useState(false)
|
|
const [isPaused, setIsPaused] = useState(false)
|
|
|
|
+ const [wasPausedOnTop, setWasPausedTop] = useState(false)
|
|
const isAllowed = usePersonalDataStore((state) => state.allowMinimizedPleyer)
|
|
const isAllowed = usePersonalDataStore((state) => state.allowMinimizedPleyer)
|
|
const mdMatch = useMediaMatch('md')
|
|
const mdMatch = useMediaMatch('md')
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
if (isInView) {
|
|
if (isInView) {
|
|
setForceExit(false)
|
|
setForceExit(false)
|
|
|
|
+ setWasPausedTop(isPaused)
|
|
}
|
|
}
|
|
- }, [isInView])
|
|
|
|
|
|
+ }, [isInView, isPaused])
|
|
|
|
|
|
- const inView = isAllowed && mdMatch && !isPaused ? isInView || forceExit : true
|
|
|
|
|
|
+ const inView = isAllowed && mdMatch && !wasPausedOnTop ? isInView || forceExit : true
|
|
|
|
|
|
return (
|
|
return (
|
|
<Wrapper isInView={inView}>
|
|
<Wrapper isInView={inView}>
|