vod 자동재생 추가

This commit is contained in:
opacity@t-win.kr
2025-10-21 10:10:22 +09:00
parent 86893ca547
commit fd638bd736

View File

@@ -1844,39 +1844,69 @@ const PlayerPanel = ({
}; };
}, []); }, []);
const onEnded = useCallback((e) => { const onEnded = useCallback(
if (panelInfoRef.current.shptmBanrTpNm === "MEDIA") { (e) => {
dispatch( if (panelInfoRef.current.shptmBanrTpNm === "MEDIA") {
updatePanel({ dispatch(
name: panel_names.DETAIL_PANEL, updatePanel({
panelInfo: { name: panel_names.DETAIL_PANEL,
launchedFromPlayer: true, panelInfo: {
isPlayerFinished: true, launchedFromPlayer: true,
}, isPlayerFinished: true,
}) },
); })
Spotlight.pause(); );
setTimeout(() => { Spotlight.pause();
Spotlight.resume(); setTimeout(() => {
dispatch(PanelActions.popPanel()); Spotlight.resume();
}, VIDEO_END_ACTION_DELAY); dispatch(PanelActions.popPanel());
return; }, VIDEO_END_ACTION_DELAY);
} return;
if (panelInfoRef.current.shptmBanrTpNm === "VOD") { }
Spotlight.pause(); if (panelInfoRef.current.shptmBanrTpNm === "VOD") {
setTimeout(() => { // 플레이리스트에서 다음 비디오가 있는지 확인
Spotlight.resume(); const currentIndex = selectedIndex;
if (panelInfoRef.current.modal) { const nextIndex = currentIndex + 1;
videoPlayer.current.play();
if (
playListInfo &&
nextIndex < playListInfo.length &&
playListInfo[nextIndex]?.showId
) {
// 다음 비디오가 있으면 자동으로 다음 비디오 재생
setSelectedIndex(nextIndex);
dispatch(
getMainCategoryShowDetail({
patnrId: playListInfo[nextIndex]?.patnrId,
showId: playListInfo[nextIndex]?.showId,
curationId: playListInfo[nextIndex]?.curationId,
})
);
// 비디오가 로드될 때까지 잠시 대기 후 재생
setTimeout(() => {
if (videoPlayer.current) {
videoPlayer.current.play();
}
}, 1000);
} else { } else {
dispatch(PanelActions.popPanel(panel_names.PLAYER_PANEL)); // 다음 비디오가 없으면 기존 로직 실행
Spotlight.pause();
setTimeout(() => {
Spotlight.resume();
if (panelInfoRef.current.modal) {
videoPlayer.current.play();
} else {
dispatch(PanelActions.popPanel(panel_names.PLAYER_PANEL));
}
}, VIDEO_END_ACTION_DELAY);
} }
}, VIDEO_END_ACTION_DELAY); e?.stopPropagation();
e?.stopPropagation(); e?.preventDefault();
e?.preventDefault(); return;
return; }
} },
}, []); [selectedIndex, playListInfo, dispatch]
);
const onKeyDown = (ev) => { const onKeyDown = (ev) => {
if (ev.keyCode === 34) { if (ev.keyCode === 34) {