[랜돔 유닛] 비디오 포커스 수정

This commit is contained in:
sungmin.in
2024-07-29 16:45:41 +09:00
parent 7cf117ba93
commit 013cdd86e4

View File

@@ -146,6 +146,26 @@ export default function RandomUnit({
const onFocus = useCallback(() => {
setIsFocused(true);
timerRef.current = setTimeout(
() =>
dispatch(
startVideoPlayer({
showUrl: randomData.showUrl,
patnrId: randomData.patnrId,
showId: randomData.showId,
shptmBanrTpNm: randomData.showId
? randomData.shptmBanrTpNm
: "MEDIA",
lgCatCd: randomData.lgCatCd,
chanId: randomData.brdcChnlId,
modal: true,
modalContainerId: spotlightId,
modalClassName: css.videoModal,
})
),
1000
);
if (handleItemFocus) {
handleItemFocus();
}
@@ -154,6 +174,7 @@ export default function RandomUnit({
// 포커스 아웃
const onBlur = useCallback(() => {
setIsFocused(false);
setVideoError(false);
clearTimeout(timerRef.current);
dispatch(finishVideoPreview());
@@ -394,36 +415,36 @@ export default function RandomUnit({
}
}, [randomData]);
useEffect(() => {
if (isFocused && !videoError) {
timerRef.current = setTimeout(
() =>
dispatch(
startVideoPlayer({
showUrl: randomData.showUrl,
patnrId: randomData.patnrId,
showId: randomData.showId,
shptmBanrTpNm: randomData.showId
? randomData.shptmBanrTpNm
: "MEDIA",
lgCatCd: randomData.lgCatCd,
chanId: randomData.brdcChnlId,
modal: true,
modalContainerId: spotlightId,
modalClassName: css.videoModal,
})
),
1000
);
}
if (!isFocused) {
setVideoError(false);
// dispatch(finishVideoPreview());
}
return () => {
clearTimeout(timerRef.current);
};
}, [isFocused]);
// useEffect(() => {
// if (isFocused && !videoError) {
// timerRef.current = setTimeout(
// () =>
// dispatch(
// startVideoPlayer({
// showUrl: randomData.showUrl,
// patnrId: randomData.patnrId,
// showId: randomData.showId,
// shptmBanrTpNm: randomData.showId
// ? randomData.shptmBanrTpNm
// : "MEDIA",
// lgCatCd: randomData.lgCatCd,
// chanId: randomData.brdcChnlId,
// modal: true,
// modalContainerId: spotlightId,
// modalClassName: css.videoModal,
// })
// ),
// 1000
// );
// }
// if (!isFocused) {
// setVideoError(false);
// // dispatch(finishVideoPreview());
// }
// return () => {
// clearTimeout(timerRef.current);
// };
// }, [isFocused]);
useEffect(() => {
if (isFocused && broadcast?.type === "videoError") {