From 53b012db2e7ad0dc88e10ae81f0d6d2adec3b078 Mon Sep 17 00:00:00 2001 From: optrader Date: Wed, 12 Nov 2025 20:31:12 +0900 Subject: [PATCH] [251112] feat: MediaPlayer Video Log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ• ์ปค๋ฐ‹ ์‹œ๊ฐ„: 2025. 11. 12. 20:31:11 ๐Ÿ“Š ๋ณ€๊ฒฝ ํ†ต๊ณ„: โ€ข ์ด ํŒŒ์ผ: 1๊ฐœ โ€ข ์ถ”๊ฐ€: +114์ค„ โ€ข ์‚ญ์ œ: -9์ค„ ๐Ÿ“ ์ˆ˜์ •๋œ ํŒŒ์ผ: ~ com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx ๐Ÿ”ง ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ: โ€ข ์ค‘๊ฐ„ ๊ทœ๋ชจ ๊ธฐ๋Šฅ ๊ฐœ์„  --- .../ProductVideo/ProductVideo.v2.jsx | 123 ++++++++++++++++-- 1 file changed, 114 insertions(+), 9 deletions(-) diff --git a/com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx b/com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx index 42aaaec1..93ffe9eb 100644 --- a/com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx +++ b/com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx @@ -120,26 +120,131 @@ export function ProductVideoV2({ // YouTube ๋น„๋””์˜ค ์ฒดํฌ const isYoutube = useMemo(() => { const url = productInfo?.prdtMediaUrl; - if (url && url.includes('youtu')) { - return true; + console.log('๐ŸŽฅ [VIDEO FORMAT] YouTube ์ฒดํฌ ์‹œ์ž‘', { + url: url, + hasUrl: !!url, + isProductInfoAvailable: !!productInfo, + productInfoKeys: productInfo ? Object.keys(productInfo) : null, + timestamp: new Date().toISOString(), + }); + + if (url) { + const isYoutuInUrl = url.includes('youtu'); + const isYouTubeDomain = url.includes('youtube.com') || url.includes('youtu.be'); + const isYouTubeShort = url.includes('youtube.com/shorts'); + + console.log('๐ŸŽฅ [VIDEO FORMAT] YouTube URL ๋ถ„์„ ๊ฒฐ๊ณผ', { + originalUrl: url, + isYoutuInUrl, + isYouTubeDomain, + isYouTubeShort, + finalResult: isYoutuInUrl, + urlProtocol: url.split('://')[0], + urlDomain: url.split('://')[1]?.split('/')[0], + urlPath: url.split('://')[1]?.split('/').slice(1).join('/'), + timestamp: new Date().toISOString(), + }); + + return isYoutuInUrl; + } else { + console.log('๐ŸŽฅ [VIDEO FORMAT] URL์ด ์—†์–ด YouTube ์ฒดํฌ ์‹คํŒจ', { + url: url, + reason: 'URL is null or undefined', + timestamp: new Date().toISOString(), + }); } + return false; }, [productInfo?.prdtMediaUrl]); // ๋น„๋””์˜ค ํƒ€์ž… ๊ฒฐ์ • const videoType = useMemo(() => { const url = productInfo?.prdtMediaUrl; + + console.log('๐ŸŽฅ [VIDEO FORMAT] ๋น„๋””์˜ค ํƒ€์ž… ๊ฒฐ์ • ์‹œ์ž‘', { + url: url, + hasUrl: !!url, + isProductInfoAvailable: !!productInfo, + timestamp: new Date().toISOString(), + }); + if (url) { - if (url.toLowerCase().endsWith('.mp4')) { - return 'video/mp4'; - } else if (url.toLowerCase().endsWith('.mpd')) { - return 'application/dash+xml'; - } else if (url.toLowerCase().endsWith('.m3u8')) { - return 'application/mpegurl'; + const lowerUrl = url.toLowerCase(); + const isMp4 = lowerUrl.endsWith('.mp4'); + const isMpd = lowerUrl.endsWith('.mpd'); + const isM3u8 = lowerUrl.endsWith('.m3u8'); + const isHls = lowerUrl.includes('.m3u8') || lowerUrl.includes('playlist.m3u8'); + const isDash = lowerUrl.includes('.mpd') || lowerUrl.includes('dash'); + + // URL ๊ตฌ์กฐ ๋ถ„์„ + const urlParts = { + protocol: url.split('://')[0], + domain: url.split('://')[1]?.split('/')[0], + path: url.split('://')[1]?.split('/').slice(1).join('/'), + filename: url.split('/').pop(), + extension: url.split('.').pop()?.toLowerCase(), + query: url.split('?')[1], + hasQuery: url.includes('?'), + }; + + console.log('๐ŸŽฅ [VIDEO FORMAT] URL ๊ตฌ์กฐ ๋ถ„์„', { + originalUrl: url, + lowerUrl: lowerUrl, + urlParts: urlParts, + extensionChecks: { + isMp4, + isMpd, + isM3u8, + isHls, + isDash, + }, + timestamp: new Date().toISOString(), + }); + + let determinedType; + let determinationReason; + + if (isMp4) { + determinedType = 'video/mp4'; + determinationReason = 'MP4 direct file extension'; + } else if (isMpd) { + determinedType = 'application/dash+xml'; + determinationReason = 'DASH manifest file extension'; + } else if (isM3u8) { + determinedType = 'application/mpegurl'; + determinationReason = 'HLS playlist file extension'; + } else if (isHls) { + determinedType = 'application/mpegurl'; + determinationReason = 'HLS playlist detected in URL path'; + } else if (isDash) { + determinedType = 'application/dash+xml'; + determinationReason = 'DASH manifest detected in URL path'; + } else { + determinedType = 'application/mpegurl'; // ๊ธฐ๋ณธ๊ฐ’ + determinationReason = 'No specific format detected, defaulting to HLS'; } + + console.log('๐ŸŽฅ [VIDEO FORMAT] ์ตœ์ข… ํƒ€์ž… ๊ฒฐ์ •', { + determinedType, + determinationReason, + isYouTubeFormat: isYoutube, + extensionChecks: { isMp4, isMpd, isM3u8, isHls, isDash }, + urlParts, + timestamp: new Date().toISOString(), + }); + + return determinedType; + } else { + console.log('๐ŸŽฅ [VIDEO FORMAT] URL์ด ์—†์–ด ๊ธฐ๋ณธ ํƒ€์ž… ์‚ฌ์šฉ', { + url: url, + reason: 'URL is null or undefined', + fallbackType: 'application/mpegurl', + timestamp: new Date().toISOString(), + }); } + return 'application/mpegurl'; - }, [productInfo?.prdtMediaUrl]); + }, [productInfo?.prdtMediaUrl, isYoutube]); // ์ž๋ง‰ ์„ค์ • const reactPlayerSubtitleConfig = useMemo(() => {