[251112] feat: MediaPlayer Video Log
🕐 커밋 시간: 2025. 11. 12. 20:31:11 📊 변경 통계: • 총 파일: 1개 • 추가: +114줄 • 삭제: -9줄 📝 수정된 파일: ~ com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx 🔧 주요 변경 내용: • 중간 규모 기능 개선
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user