diff --git a/static/app.js b/static/app.js index 48cd0ed..d57b14d 100644 --- a/static/app.js +++ b/static/app.js @@ -358,7 +358,20 @@ segmentDiv.className = 'transcript-segment'; segmentDiv.dataset.text = (segment.text || '').toLowerCase(); - const startSeconds = segment.start_seconds || segment.start || 0; + // Handle multiple possible timestamp field names and formats + let startSeconds = segment.start_seconds + || segment.start + || segment.offset + || segment.time + || segment.timestamp + || segment.startTime + || 0; + + // If timestamp is in milliseconds (> 10000 for timestamps after ~2.7 hours), convert to seconds + if (startSeconds > 10000) { + startSeconds = startSeconds / 1000; + } + const timestampText = formatTimestamp(startSeconds); const timestampUrl = getYouTubeTimestampUrl(videoUrl, startSeconds); @@ -603,6 +616,11 @@ secondaryHeader.textContent = 'Secondary Transcript'; transcriptDiv.appendChild(secondaryHeader); + // Debug: log first secondary segment structure + if (secondaryParts[0]) { + console.log('Secondary transcript segment structure:', secondaryParts[0]); + } + secondaryParts.forEach(segment => { transcriptDiv.appendChild(renderTranscriptSegment(segment, videoUrl)); });