플레이어 라이브 자동재생목록 순서 정렬

This commit is contained in:
opacity@t-win.kr
2025-10-28 13:40:38 +09:00
parent 1e9b84170e
commit 742360c04d

View File

@@ -322,6 +322,7 @@ const PlayerPanel = ({
const mediaLogParamsRef = useRef(null); const mediaLogParamsRef = useRef(null);
const prevNowMenuRef = useRef(null); const prevNowMenuRef = useRef(null);
const watchInterval = useRef(null); const watchInterval = useRef(null);
const liveShowEndCalledRef = useRef(false);
const currentLiveShowInfo = useMemo(() => { const currentLiveShowInfo = useMemo(() => {
if (liveShowInfos && liveShowInfos.length > 0) { if (liveShowInfos && liveShowInfos.length > 0) {
@@ -1087,7 +1088,6 @@ const PlayerPanel = ({
}, [ }, [
dispatch, dispatch,
panelInfo?.curationId, panelInfo?.curationId,
panelInfo?.lgCatCd,
panelInfo?.patnrId, panelInfo?.patnrId,
panelInfo?.showId, panelInfo?.showId,
panelInfo?.shptmBanrTpNm, panelInfo?.shptmBanrTpNm,
@@ -1272,7 +1272,21 @@ const PlayerPanel = ({
playlist.forEach((item) => { playlist.forEach((item) => {
if (item.showType === "vod" && Array.isArray(item.vodInfos)) { if (item.showType === "vod" && Array.isArray(item.vodInfos)) {
const mergedVodInfos = item.vodInfos.map((vod) => ({ // vodInfos를 정렬 (showId 기준)
const sortedVodInfos = [...item.vodInfos].sort((a, b) => {
// showId가 있으면 showId로 정렬
if (a.showId && b.showId) {
return a.showId.localeCompare(b.showId);
}
// strtDt가 있으면 시작일로 정렬
if (a.strtDt && b.strtDt) {
return new Date(a.strtDt) - new Date(b.strtDt);
}
// 정렬 기준이 없으면 원래 순서 유지
return 0;
});
const mergedVodInfos = sortedVodInfos.map((vod) => ({
...vod, ...vod,
patnrId: item.patnrId, patnrId: item.patnrId,
patncNm: item.patncNm, patncNm: item.patncNm,
@@ -1402,8 +1416,17 @@ const PlayerPanel = ({
} }
}, [liveTotalTime]); }, [liveTotalTime]);
// showId 변경 시 liveShowEndCalled 리셋
useEffect(() => { useEffect(() => {
if (currentLiveTimeSeconds > liveTotalTime) { liveShowEndCalledRef.current = false;
}, [panelInfo?.showId]);
useEffect(() => {
if (
currentLiveTimeSeconds > liveTotalTime &&
!liveShowEndCalledRef.current
) {
liveShowEndCalledRef.current = true;
setTimeout(() => { setTimeout(() => {
dispatch(getMainLiveShow()); dispatch(getMainLiveShow());
setShopNowInfo(""); setShopNowInfo("");