라이브 채널 리스트에 VOD 채널 추가 로직

This commit is contained in:
dongyoungKo
2025-05-27 18:00:44 +09:00
parent a55bc49ef3
commit 460fae80fa
6 changed files with 71 additions and 43 deletions

View File

@@ -1059,7 +1059,7 @@ const PlayerPanel = ({
})
);
}
dispatch(getMainLiveShow());
dispatch(getMainLiveShow({ vodIncFlag: "Y" }));
}
}, [
dispatch,
@@ -1220,8 +1220,29 @@ const PlayerPanel = ({
switch (panelInfo.shptmBanrTpNm) {
case "LIVE": {
const playlist = liveShowInfos ? liveShowInfos : liveChannelInfos;
setPlayListInfo(playlist);
const playlist = liveShowInfos ?? liveChannelInfos;
if (!Array.isArray(playlist)) return;
const modifiedList = [];
playlist.forEach((item) => {
if (item.showType === "vod" && Array.isArray(item.vodInfos)) {
const mergedVodInfos = item.vodInfos.map((vod) => ({
...vod,
patnrId: item.patnrId,
patncNm: item.patncNm,
patncLogoPath: item.patncLogoPath,
showType: "vod",
}));
modifiedList.push(...mergedVodInfos);
} else {
modifiedList.push(item);
}
});
setPlayListInfo(modifiedList);
if (showNowInfos?.prdtChgYn === "N") {
return;
@@ -1895,6 +1916,17 @@ const PlayerPanel = ({
panelInfo?.qrCurrentItem,
]);
const isShowType = useMemo(() => {
if (["VOD", "MEDIA"].includes(panelInfo.shptmBanrTpNm)) {
return panelInfo.shptmBanrTpNm;
}
const showType = playListInfo?.[selectedIndex]?.showType;
if (showType === "live") return panelInfo.shptmBanrTpNm;
if (showType === "vod") return "VOD";
return panelInfo.shptmBanrTpNm;
}, [panelInfo.shptmBanrTpNm, playListInfo, selectedIndex]);
const clearTimer = useCallback(() => {
clearTimeout(timerId.current);
timerId.current = null;
@@ -2084,7 +2116,7 @@ const PlayerPanel = ({
currentLiveTimeSeconds={currentLiveTimeSeconds}
countryCode={countryCode}
// VideoOverlay props
type={panelInfo?.shptmBanrTpNm}
type={isShowType}
panelInfo={panelInfo}
captionEnable={captionEnable}
orderPhnNo={orderPhoneNumber}
@@ -2133,7 +2165,7 @@ const PlayerPanel = ({
<PlayerTabButton
setSideContentsVisible={setSideContentsVisible}
sideContentsVisible={sideContentsVisible}
videoType={panelInfo?.shptmBanrTpNm}
videoType={isShowType}
/>
)}