import Spotlight from '@enact/spotlight'; import { URLS } from '../api/apiConfig'; import { TAxios } from '../api/TAxios'; import { panel_names } from '../utils/Config'; import { types } from './actionTypes'; import { popPanel, pushPanel, updatePanel } from './panelActions'; //yhcho /* dispatch(startVideoPreview({ patnrId: randomData.patnrId, showId: randomData.showId, shptmBanrTpNm: randomData.shptmBanrTpNm, lgCatCd: randomData.lgCatCd, modal: true, modalContainerRef: videoModalContainerRef.current, //to calc width, height, left, top modalClassName:css.videoModal })); modalClassName: modal more class info and checking it's launched from preview mode */ let startVideoTimer = null; //start modal mode //start Full -> modal mode let startVideoFocusTimer = null; // ๐Ÿ”ฝ ์ „์—ญ ํƒ€์ด๋จธ ์ •๋ฆฌ ํ•จ์ˆ˜ - ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜ ๋ฐฉ์ง€ export const clearAllVideoTimers = () => { if (startVideoFocusTimer) { clearTimeout(startVideoFocusTimer); startVideoFocusTimer = null; console.log('[playActions] startVideoFocusTimer cleared'); } if (startVideoTimer) { clearTimeout(startVideoTimer); startVideoTimer = null; console.log('[playActions] startVideoTimer cleared'); } }; export const startVideoPlayer = ({ modal, modalContainerId, modalClassName, spotlightDisable, useNewPlayer, ...rest }) => (dispatch, getState) => { const panels = getState().panels.panels; const topPanel = panels[panels.length - 1]; let panelWorkingAction = pushPanel; // const panelName = useNewPlayer ? panel_names.PLAYER_PANEL_NEW : panel_names.PLAYER_PANEL; const panelName = panel_names.PLAYER_PANEL; if (topPanel && topPanel.name === panelName) { panelWorkingAction = updatePanel; } dispatch( panelWorkingAction( { name: panelName, panelInfo: { modal, modalContainerId, modalClassName, ...rest, }, }, true ) ); if (modal && modalContainerId && !spotlightDisable) { Spotlight.setPointerMode(false); startVideoFocusTimer = setTimeout(() => { Spotlight.focus(modalContainerId); }, 0); } }; // ์ค‘๋ณต ์žฌ์ƒ ๋ฐฉ์ง€: ์ •๋ง ๋™์ผํ•œ ์š”์ฒญ์ธ์ง€ ํ™•์ธ // ๊ฐ™์€ ๋ฐฐ๋„ˆ + ๊ฐ™์€ modal ์ƒํƒœ + ๊ฐ™์€ ์œ„์น˜ = ์ •๋ง ๋™์ผํ•œ ์š”์ฒญ์ด๋ฏ€๋กœ skip const shouldSkipVideoPlayback = ( currentPanelInfo, newModalState, newModalContainerId, newBannerId ) => { if (!currentPanelInfo) return false; const currentBannerId = currentPanelInfo.playerState?.currentBannerId; const currentModal = currentPanelInfo.modal; const currentModalContainerId = currentPanelInfo.modalContainerId; return ( currentBannerId === newBannerId && currentModal === newModalState && currentModalContainerId === newModalContainerId ); }; export const startVideoPlayerNew = ({ modal, modalContainerId, modalClassName, spotlightDisable, useNewPlayer, bannerId, ...rest }) => (dispatch, getState) => { const panels = getState().panels.panels; const topPanel = panels[panels.length - 1]; let panelWorkingAction = pushPanel; // const panelName = useNewPlayer ? panel_names.PLAYER_PANEL_NEW : panel_names.PLAYER_PANEL; const panelName = panel_names.PLAYER_PANEL; if (topPanel && topPanel.name === panelName) { panelWorkingAction = updatePanel; } // playerState ์—…๋ฐ์ดํŠธ: ๊ธฐ์กด playerState์™€ ์ƒˆ ๋ฐ์ดํ„ฐ ๋ณ‘ํ•ฉ const currentPlayerState = topPanel?.panelInfo?.playerState || {}; // โœ… ์ •ํ™•ํ•œ ๋น„๊ต: ๊ฐ™์€ ๋ฐฐ๋„ˆ + ๊ฐ™์€ modal ์ƒํƒœ + ๊ฐ™์€ ์œ„์น˜์ผ ๋•Œ๋งŒ skip if (shouldSkipVideoPlayback(topPanel?.panelInfo, modal, modalContainerId, bannerId)) { return; } const newPlayerState = { ...currentPlayerState, currentBannerId: bannerId, }; dispatch( panelWorkingAction( { name: panelName, panelInfo: { modal, modalContainerId, modalClassName, playerState: newPlayerState, ...rest, }, }, true ) ); if (modal && modalContainerId && !spotlightDisable) { Spotlight.setPointerMode(false); startVideoFocusTimer = setTimeout(() => { Spotlight.focus(modalContainerId); }, 0); } }; export const finishVideoPreview = () => (dispatch, getState) => { const panels = getState().panels.panels; const topPanel = panels[panels.length-1]; if (topPanel && topPanel.name === panel_names.PLAYER_PANEL && topPanel.panelInfo.modal) { if (startVideoFocusTimer) { clearTimeout(startVideoFocusTimer); startVideoFocusTimer = null; } dispatch(popPanel()); } }; export const finishModalVideoForce = () => (dispatch, getState) => { const panels = getState().panels.panels; // modal PlayerPanel์ด ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธ (์Šคํƒ ์–ด๋””์— ์žˆ๋“ ) const hasModalPlayerPanel = panels.some( (panel) => panel.name === panel_names.PLAYER_PANEL && panel.panelInfo?.modal ); if (hasModalPlayerPanel) { if (startVideoFocusTimer) { clearTimeout(startVideoFocusTimer); startVideoFocusTimer = null; } // panelName์„ ์ง€์ •ํ•˜๋ฉด ์Šคํƒ ์–ด๋””์— ์žˆ๋“  ํ•ด๋‹น ํŒจ๋„์„ ์ œ๊ฑฐ dispatch(popPanel(panel_names.PLAYER_PANEL)); } }; // ๋ชจ๋“  PlayerPanel์„ ๊ฐ•์ œ ์ œ๊ฑฐ (modal๊ณผ fullscreen ๋ชจ๋‘) export const finishAllVideoForce = () => (dispatch, getState) => { const panels = getState().panels.panels; // ๋ชจ๋“  PlayerPanel์ด ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธ (์Šคํƒ ์–ด๋””์— ์žˆ๋“ ) const hasPlayerPanel = panels.some( (panel) => panel.name === panel_names.PLAYER_PANEL ); if (hasPlayerPanel) { if (startVideoFocusTimer) { clearTimeout(startVideoFocusTimer); startVideoFocusTimer = null; } // panelName์„ ์ง€์ •ํ•˜๋ฉด ์Šคํƒ ์–ด๋””์— ์žˆ๋“  ํ•ด๋‹น ํŒจ๋„์„ ์ œ๊ฑฐ dispatch(popPanel(panel_names.PLAYER_PANEL)); } }; // ๋ชจ๋‹ฌ ๋น„๋””์˜ค๋ฅผ ์ผ์‹œ์ •์ง€ (ํŒจ๋„์€ ์œ ์ง€) export const pauseModalVideo = () => (dispatch, getState) => { const panels = getState().panels.panels; // modal PlayerPanel ์ฐพ๊ธฐ const modalPlayerPanel = panels.find( (panel) => panel.name === panel_names.PLAYER_PANEL && panel.panelInfo?.modal ); if (modalPlayerPanel) { console.log('[pauseModalVideo] Pausing modal video'); dispatch( updatePanel({ name: panel_names.PLAYER_PANEL, panelInfo: { ...modalPlayerPanel.panelInfo, isPaused: true, // ์ผ์‹œ์ •์ง€ ํ”Œ๋ž˜๊ทธ ์ถ”๊ฐ€ }, }) ); } }; // ๋ชจ๋‹ฌ ๋น„๋””์˜ค๋ฅผ ์žฌ์ƒ (์ผ์‹œ์ •์ง€ ํ•ด์ œ) export const resumeModalVideo = () => (dispatch, getState) => { const panels = getState().panels.panels; // modal PlayerPanel ์ฐพ๊ธฐ const modalPlayerPanel = panels.find( (panel) => panel.name === panel_names.PLAYER_PANEL && panel.panelInfo?.modal ); if (modalPlayerPanel && modalPlayerPanel.panelInfo?.isPaused) { console.log('[resumeModalVideo] Resuming modal video'); dispatch( updatePanel({ name: panel_names.PLAYER_PANEL, panelInfo: { ...modalPlayerPanel.panelInfo, isPaused: false, // ์ผ์‹œ์ •์ง€ ํ•ด์ œ }, }) ); } }; // ์ „์ฒดํ™”๋ฉด ๋น„๋””์˜ค๋ฅผ ์ผ์‹œ์ •์ง€ (ํŒจ๋„์€ ์œ ์ง€) export const pauseFullscreenVideo = () => (dispatch, getState) => { const panels = getState().panels.panels; // ์ „์ฒดํ™”๋ฉด PlayerPanel ์ฐพ๊ธฐ (modal์ด false์ธ ํŒจ๋„) const fullscreenPlayerPanel = panels.find( (panel) => panel.name === panel_names.PLAYER_PANEL && !panel.panelInfo?.modal ); if (fullscreenPlayerPanel) { dispatch( updatePanel({ name: panel_names.PLAYER_PANEL, panelInfo: { ...fullscreenPlayerPanel.panelInfo, isPaused: true, // ์ผ์‹œ์ •์ง€ ํ”Œ๋ž˜๊ทธ ์ถ”๊ฐ€ }, }) ); } }; // ์ „์ฒดํ™”๋ฉด ๋น„๋””์˜ค๋ฅผ ์žฌ์ƒ (์ผ์‹œ์ •์ง€ ํ•ด์ œ) export const resumeFullscreenVideo = () => (dispatch, getState) => { const panels = getState().panels.panels; // console.log('[BgVideo] resumeFullscreenVideo called - panels:', { // panelsCount: panels?.length, // panels: panels?.map(p => ({ name: p.name, modal: p.panelInfo?.modal, isPaused: p.panelInfo?.isPaused })) // }); // ์ „์ฒดํ™”๋ฉด PlayerPanel ์ฐพ๊ธฐ (modal์ด false์ธ ํŒจ๋„) const fullscreenPlayerPanel = panels.find( (panel) => panel.name === panel_names.PLAYER_PANEL && !panel.panelInfo?.modal ); // console.log('[BgVideo] resumeFullscreenVideo - fullscreenPlayerPanel found:', !!fullscreenPlayerPanel); // console.log('[BgVideo] resumeFullscreenVideo - isPaused:', fullscreenPlayerPanel?.panelInfo?.isPaused); if (fullscreenPlayerPanel && fullscreenPlayerPanel.panelInfo?.isPaused) { // console.log('[BgVideo] resumeFullscreenVideo - dispatching updatePanel with isPaused: false'); dispatch( updatePanel({ name: panel_names.PLAYER_PANEL, panelInfo: { ...fullscreenPlayerPanel.panelInfo, isPaused: false, // ์ผ์‹œ์ •์ง€ ํ•ด์ œ }, }) ); } else { console.log('[BgVideo] resumeFullscreenVideo - Not resuming (not found or not paused)'); } }; // ๋ชจ๋‹ฌ ๋น„๋””์˜ค๋ฅผ 1px๋กœ ์ถ•์†Œ (๋ฐฐ๋„ˆ ์ •๋ณด ์ €์žฅ) export const shrinkVideoTo1px = () => (dispatch, getState) => { const panels = getState().panels.panels; // modal PlayerPanel ์ฐพ๊ธฐ const modalPlayerPanel = panels.find( (panel) => panel.name === panel_names.PLAYER_PANEL && panel.panelInfo?.modal ); if (modalPlayerPanel) { const panelInfo = modalPlayerPanel.panelInfo; // ์ถ•์†Œ ์ „ ๋ฐฐ๋„ˆ ์ •๋ณด๋ฅผ playerState์— ์ €์žฅ const updatedPlayerState = { ...(panelInfo.playerState || {}), shrinkInfo: { // ๋ณต๊ตฌ ์‹œ ํ•„์š”ํ•œ ์ •๋ณด modalContainerId: panelInfo.modalContainerId, modalClassName: panelInfo.modalClassName, modalStyle: panelInfo.modalStyle, modalScale: panelInfo.modalScale, // top, left๋Š” ๋”ฐ๋กœ ์ €์žฅ (๋ณต๊ตฌ ์‹œ ์žฌ๊ณ„์‚ฐํ•˜์ง€ ์•Š๊ธฐ ์œ„ํ•จ) top: panelInfo.modalStyle?.top, left: panelInfo.modalStyle?.left, currentBannerId: panelInfo.playerState?.currentBannerId, patnrId: panelInfo.patnrId, showId: panelInfo.showId, shptmBanrTpNm: panelInfo.shptmBanrTpNm, lgCatCd: panelInfo.lgCatCd, }, }; // console.log('[HomePanel] shrinkVideoTo1px: saving shrinkInfo', { // shrinkInfo: updatedPlayerState.shrinkInfo, // modalStyle: panelInfo.modalStyle, // }); dispatch( updatePanel({ name: panel_names.PLAYER_PANEL, panelInfo: { ...panelInfo, shouldShrinkTo1px: true, // ์ถ•์†Œ ํ”Œ๋ž˜๊ทธ ์„ค์ • playerState: updatedPlayerState, }, }) ); } else { console.log('[HomePanel] shrinkVideoTo1px: No modal PlayerPanel found'); } }; // ์ถ•์†Œ๋œ ๋ชจ๋‹ฌ ๋น„๋””์˜ค๋ฅผ ์›๋ž˜ ํฌ๊ธฐ๋กœ ๋ณต๊ตฌ export const expandVideoFrom1px = () => (dispatch, getState) => { const panels = getState().panels.panels; // ์ถ•์†Œ๋œ modal PlayerPanel ์ฐพ๊ธฐ const shrunkModalPlayerPanel = panels.find( (panel) => panel.name === panel_names.PLAYER_PANEL && panel.panelInfo?.modal && panel.panelInfo?.shouldShrinkTo1px ); if (shrunkModalPlayerPanel) { const panelInfo = shrunkModalPlayerPanel.panelInfo; const shrinkInfo = panelInfo.playerState?.shrinkInfo; // console.log('[HomePanel] expandVideoFrom1px: expanding video', { // hasShrinkInfo: !!shrinkInfo, // hasModalStyle: !!shrinkInfo?.modalStyle, // hasModalContainerId: !!shrinkInfo?.modalContainerId, // }); const updatedPanelInfo = { ...panelInfo, shouldShrinkTo1px: false, // ์ถ•์†Œ ํ”Œ๋ž˜๊ทธ ํ•ด์ œ skipModalStyleRecalculation: true, // โ† ๋ณต๊ตฌ ๊ณผ์ •์—์„œ DOM ์žฌ๊ณ„์‚ฐ ์Šคํ‚ต // ์ €์žฅ๋œ ์ •๋ณด๋กœ ๋ณต๊ตฌ ...(shrinkInfo && { modalContainerId: shrinkInfo.modalContainerId, modalClassName: shrinkInfo.modalClassName, modalStyle: shrinkInfo.modalStyle, modalScale: shrinkInfo.modalScale, }), }; // console.log('[HomePanel] expandVideoFrom1px: updated panelInfo shouldShrinkTo1px=false, modalStyle restored, skipModalStyleRecalculation=true'); dispatch( updatePanel({ name: panel_names.PLAYER_PANEL, panelInfo: updatedPanelInfo, }) ); } else { console.log('[HomePanel] expandVideoFrom1px: No shrunk modal PlayerPanel found'); } }; // ์ฑ„ํŒ… ๋กœ๊ทธ ๊ฐ€์ ธ์˜ค๊ธฐ IF-LGSP-371 export const getChatLog = ({ patnrId, showId }) => (dispatch, getState) => { const onSuccess = (response) => { console.log('getChatLog onSuccess', response.data); dispatch({ type: types.GET_CHAT_LOG, payload: response.data.data, }); }; const onFail = (error) => { console.error('getChatLog onFail', error); }; TAxios(dispatch, getState, 'get', URLS.CHAT_LOG, { patnrId, showId }, {}, onSuccess, onFail); }; // VOD ์ž๋ง‰ ๊ฐ€์ ธ์˜ค๊ธฐ IF-LGSP-072 export const getSubTitle = ({ showSubtitleUrl }) => (dispatch, getState) => { const onSuccess = (response) => { console.log('getSubTitle onSuccess', response.data); dispatch({ type: types.GET_SUBTITLE, payload: { url: showSubtitleUrl, data: response.data.data }, }); }; const onFail = (error) => { console.error('getSubTitle onFail', error); dispatch({ type: types.GET_SUBTITLE, payload: { url: showSubtitleUrl, data: 'Error' }, }); }; if (!getState().play.subTitleBlobs[showSubtitleUrl]) { TAxios(dispatch, getState, 'get', URLS.SUBTITLE, { showSubtitleUrl }, {}, onSuccess, onFail); } else { console.log("playActions getSubTitle no Nothing it's exist", showSubtitleUrl); } }; export const CLEAR_PLAYER_INFO = () => ({ type: types.CLEAR_PLAYER_INFO, }); /** * ๋น„๋””์˜ค ์žฌ์ƒ ์ƒํƒœ๋ฅผ Redux์— ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค. * @param {Object} playState - ์—…๋ฐ์ดํŠธํ•  ์žฌ์ƒ ์ƒํƒœ * @param {boolean} playState.isPlaying - ์žฌ์ƒ ์ค‘์ธ์ง€ ์—ฌ๋ถ€ * @param {boolean} playState.isPaused - ์ผ์‹œ์ •์ง€ ์ƒํƒœ์ธ์ง€ ์—ฌ๋ถ€ * @param {number} playState.currentTime - ํ˜„์žฌ ์žฌ์ƒ ์‹œ๊ฐ„(์ดˆ) * @param {number} playState.duration - ์ „์ฒด ๋น„๋””์˜ค ๊ธธ์ด(์ดˆ) * @param {number} playState.playbackRate - ์žฌ์ƒ ์†๋„ */ export const updateVideoPlayState = (playState) => ({ type: types.UPDATE_VIDEO_PLAY_STATE, payload: playState, }); /* ๐Ÿ”ฝ [์ถ”๊ฐ€] ์ƒˆ๋กœ์šด 'ํ”Œ๋ ˆ์ด ์ œ์–ด ๋งค๋‹ˆ์ €' ์•ก์…˜๋“ค */ /** * ๋น„๋””์˜ค ์žฌ์ƒ ์ œ์–ด๊ถŒ์„ ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค. * ์ปดํฌ๋„ŒํŠธ๋Š” ์ด ์•ก์…˜์„ ํ†ตํ•ด ์ค‘์•™ ๋งค๋‹ˆ์ €์—๊ฒŒ ์žฌ์ƒ์„ '์š”์ฒญ'ํ•ฉ๋‹ˆ๋‹ค. * @param {string} ownerId - ์ œ์–ด๊ถŒ์„ ์š”์ฒญํ•˜๋Š” ์ปดํฌ๋„ŒํŠธ์˜ ๊ณ ์œ  ID (์˜ˆ: 'banner0_persistent') * @param {object} videoInfo - ์žฌ์ƒํ•  ๋น„๋””์˜ค ์ •๋ณด (url, id ๋“ฑ) */ export const requestPlayControl = (ownerId, videoInfo) => (dispatch, getState) => { const { playerControl } = getState().home; const currentOwnerId = playerControl.ownerId; if (currentOwnerId === ownerId) return; // ์ด๋ฏธ ์ œ์–ด๊ถŒ ์†Œ์œ  if (currentOwnerId) { // ํ˜„์žฌ ์ œ์–ด์ค‘์ธ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์˜๊ตฌ์žฌ์ƒ ๋ฐฐ๋„ˆ์ด๋ฉด '์ผ์‹œ์ •์ง€' if (currentOwnerId === 'banner0_persistent') { dispatch(pausePlayerControl()); } else { // ๋‹ค๋ฅธ ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋ผ๋ฉด ์™„์ „ํžˆ ์ˆจ๊น€ dispatch(releasePlayControl(currentOwnerId, true)); } } // 1. ๋งค๋‹ˆ์ € ์ƒํƒœ ์—…๋ฐ์ดํŠธ dispatch({ type: types.SET_PLAYER_CONTROL, payload: { ownerId } }); // 2. ๊ณต์œ  PlayerPanel์˜ ์ƒํƒœ ์—…๋ฐ์ดํŠธ dispatch( updatePanel({ name: panel_names.PLAYER_PANEL, panelInfo: { isHidden: false, modal: true, ...videoInfo, }, }) ); }; /** * ๋น„๋””์˜ค ์žฌ์ƒ ์ œ์–ด๊ถŒ์„ ํ•ด์ œํ•˜๊ณ , ํ•„์š”์‹œ ์˜๊ตฌ์žฌ์ƒ ๋น„๋””์˜ค๋ฅผ ๋ณต์›ํ•ฉ๋‹ˆ๋‹ค. * @param {string} ownerId - ์ œ์–ด๊ถŒ์„ ํ•ด์ œํ•˜๋Š” ์ปดํฌ๋„ŒํŠธ์˜ ๊ณ ์œ  ID * @param {boolean} fromPreemption - ๋‹ค๋ฅธ ์š”์ฒญ์— ์˜ํ•ด ๊ฐ•์ œ๋กœ ์ค‘๋‹จ๋˜์—ˆ๋Š”์ง€ ์—ฌ๋ถ€ */ export const releasePlayControl = (ownerId, fromPreemption = false) => (dispatch, getState) => { const { playerControl } = getState().home; if (fromPreemption || playerControl.ownerId === ownerId) { // 1. ๊ณต์œ  PlayerPanel์„ ๋‹ค์‹œ ์ˆจ๊น€ dispatch( updatePanel({ name: panel_names.PLAYER_PANEL, panelInfo: { isHidden: true, }, }) ); // 2. ๋งค๋‹ˆ์ € ์ƒํƒœ ์—…๋ฐ์ดํŠธ (ํ˜„์žฌ ์†Œ์œ ์ฃผ ์—†์Œ) dispatch({ type: types.CLEAR_PLAYER_CONTROL }); // 3. ๋งŒ์•ฝ '์ผ์‹œ์ •์ง€'๋œ ์˜๊ตฌ์žฌ์ƒ ๋น„๋””์˜ค๊ฐ€ ์žˆ์—ˆ๋‹ค๋ฉด, ์ œ์–ด๊ถŒ์„ ๋˜๋Œ๋ ค์ฃผ๊ณ  ๋‹ค์‹œ ์žฌ์ƒ if (playerControl.isPaused && playerControl.ownerId === 'banner0_persistent') { const persistentVideoInfo = { /* ์˜๊ตฌ ๋น„๋””์˜ค ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋กœ์ง (ํ•„์š”์‹œ) */ }; dispatch(requestPlayControl('banner0_persistent', persistentVideoInfo)); } } }; /** * ํ˜„์žฌ ์žฌ์ƒ ์ค‘์ธ ๋น„๋””์˜ค๋ฅผ '์ผ์‹œ์ •์ง€' ์ƒํƒœ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ์•ก์…˜. * ์ด ํ•จ์ˆ˜๋Š” ํ”Œ๋ ˆ์ด์–ด ํŒจ๋„์„ ๋‹ซ์ง€ ์•Š๊ณ , ๋‹จ์ˆœํžˆ ๋น„๋””์˜ค ์žฌ์ƒ์„ ๋ฉˆ์ถ”๋Š” ์‹ ํ˜ธ๋ฅผ ๋ณด๋ƒ…๋‹ˆ๋‹ค. * * @param {string} ownerId - ๋น„๋””์˜ค ์ œ์–ด๊ถŒ์„ ๊ฐ€์ง„ ์ปดํฌ๋„ŒํŠธ์˜ ๊ณ ์œ  ID. */ // export const pausePlayerControl = (ownerId) => (dispatch, getState) => { // const { playerControl } = getState().home; // // ์ œ์–ด๊ถŒ์„ ๊ฐ€์ง„ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ž์‹ ์ผ ๊ฒฝ์šฐ์—๋งŒ ์ผ์‹œ์ •์ง€ // if (playerControl.ownerId === ownerId) { // dispatch({ // type: types.PAUSE_PLAYER_CONTROL, // }); // } // }; /** * '์ผ์‹œ์ •์ง€' ์ƒํƒœ์˜ ๋น„๋””์˜ค๋ฅผ ๋‹ค์‹œ ์žฌ์ƒํ•˜๋Š” ์•ก์…˜. * * @param {string} ownerId - ๋น„๋””์˜ค ์ œ์–ด๊ถŒ์„ ๊ฐ€์ง„ ์ปดํฌ๋„ŒํŠธ์˜ ๊ณ ์œ  ID. */ export const resumePlayerControl = (ownerId) => (dispatch, getState) => { const { playerControl } = getState().home; // ์ œ์–ด๊ถŒ์„ ๊ฐ€์ง„ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ž์‹ ์ด๊ณ , ์ผ์‹œ์ •์ง€ ์ƒํƒœ์ผ ๋•Œ๋งŒ ์žฌ๊ฐœ if (playerControl.ownerId === ownerId && playerControl.isPaused) { dispatch({ type: types.RESUME_PLAYER_CONTROL, }); } }; /** * ๊ณต์œ  PlayerPanel์„ ์ „์ฒดํ™”๋ฉด ๋ชจ๋“œ๋กœ ์ „ํ™˜ํ•ฉ๋‹ˆ๋‹ค. * ์ด ์•ก์…˜์€ ์–ด๋–ค ๋ฐฐ๋„ˆ์—์„œ๋“  ํด๋ฆญ ์‹œ ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค. */ export const goToFullScreen = () => (dispatch, getState) => { // ๊ณต์œ  PlayerPanel์˜ 'modal' ์ƒํƒœ๋ฅผ false๋กœ ๋ณ€๊ฒฝํ•˜์—ฌ ์ „์ฒดํ™”๋ฉด์œผ๋กœ ์ „ํ™˜ dispatch( updatePanel({ name: panel_names.PLAYER_PANEL, panelInfo: { modal: false, isHidden: false, // ํ˜น์‹œ ์ˆจ๊ฒจ์ ธ ์žˆ์—ˆ๋‹ค๋ฉด ๋ณด์ด๋„๋ก }, }) ); }; /** * ์˜๊ตฌ์žฌ์ƒ ๋น„๋””์˜ค๋ฅผ ์ผ์‹œ์ •์ง€ ์ƒํƒœ๋กœ ๋งŒ๋“ญ๋‹ˆ๋‹ค. (๋‚ด๋ถ€ ์‚ฌ์šฉ) */ export const pausePlayerControl = () => ({ type: types.PAUSE_PLAYER_CONTROL, }); /** * ์ „์ฒดํ™”๋ฉด ํ”Œ๋ ˆ์ด์–ด์—์„œ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์ƒํƒœ๋กœ ๋ณต๊ท€ํ•  ๋•Œ ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค. * ์ค‘์•™ 'playerControl' ์ƒํƒœ๋ฅผ ํ™•์ธํ•˜์—ฌ ์˜ฌ๋ฐ”๋ฅธ ์œ„์น˜์™€ ๋น„๋””์˜ค๋กœ ๋ณต์›ํ•ฉ๋‹ˆ๋‹ค. */ export const returnToPreview = () => (dispatch, getState) => { const { playerControl } = getState().home; let targetOwnerId; let targetVideoInfo; // ๋งŒ์•ฝ '์ผ์‹œ์ •์ง€'๋œ ์˜๊ตฌ์žฌ์ƒ ๋น„๋””์˜ค๊ฐ€ ์žˆ๋‹ค๋ฉด, ๋ฌด์กฐ๊ฑด ๊ทธ ๋น„๋””์˜ค๋กœ ๋ณต๊ท€ํ•˜๋Š” ๊ฒƒ์ด ์ตœ์šฐ์„  if (playerControl.isPaused) { targetOwnerId = 'banner0_persistent'; // targetVideoInfo = ... (0๋ฒˆ ๋ฐฐ๋„ˆ์˜ ๋น„๋””์˜ค ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋กœ์ง) } else { // ๊ทธ๋ ‡์ง€ ์•Š๋‹ค๋ฉด, ์ „์ฒดํ™”๋ฉด์œผ๋กœ ๊ฐ€๊ธฐ ์ง์ „์˜ ์†Œ์œ ์ฃผ(ownerId)์—๊ฒŒ๋กœ ๋ณต๊ท€ targetOwnerId = playerControl.ownerId; // targetVideoInfo = ... (ํ•ด๋‹น ownerId์˜ ๋น„๋””์˜ค ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋กœ์ง) } // ๋งค๋‹ˆ์ €์—๊ฒŒ ํ•ด๋‹น ํƒ€๊ฒŸ์œผ๋กœ ์žฌ์ƒ์„ ๋‹ค์‹œ ์š”์ฒญ if (targetOwnerId) { dispatch(requestPlayControl(targetOwnerId, targetVideoInfo)); } else { // ๋Œ์•„๊ฐˆ ๊ณณ์ด ์—†์œผ๋ฉด ๊ทธ๋ƒฅ ํ”Œ๋ ˆ์ด์–ด๋ฅผ ๋‹ซ์Œ dispatch(finishVideoPreview()); } };