| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Manim Video Player</title> |
| <style> |
| * { |
| margin: 0; |
| padding: 0; |
| box-sizing: border-box; |
| } |
| |
| body { |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| padding: 20px; |
| min-height: 100vh; |
| display: flex; |
| flex-direction: column; |
| align-items: center; |
| justify-content: center; |
| } |
| |
| .container { |
| background: white; |
| border-radius: 16px; |
| box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); |
| overflow: hidden; |
| max-width: 800px; |
| width: 100%; |
| } |
| |
| .header { |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| color: white; |
| padding: 20px; |
| text-align: center; |
| } |
| |
| .header h1 { |
| font-size: 24px; |
| margin-bottom: 5px; |
| } |
| |
| .header p { |
| font-size: 14px; |
| opacity: 0.9; |
| } |
| |
| .video-wrapper { |
| position: relative; |
| width: 100%; |
| background: #000; |
| } |
| |
| video { |
| width: 100%; |
| height: auto; |
| display: block; |
| } |
| |
| .info { |
| padding: 20px; |
| background: #f7fafc; |
| } |
| |
| .info-row { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| padding: 12px 0; |
| border-bottom: 1px solid #e2e8f0; |
| } |
| |
| .info-row:last-child { |
| border-bottom: none; |
| } |
| |
| .info-label { |
| font-weight: 600; |
| color: #4a5568; |
| font-size: 14px; |
| } |
| |
| .info-value { |
| color: #2d3748; |
| font-size: 14px; |
| font-family: 'Courier New', monospace; |
| } |
| |
| .download-btn { |
| width: 100%; |
| padding: 16px; |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| color: white; |
| border: none; |
| border-radius: 8px; |
| font-size: 16px; |
| font-weight: 600; |
| cursor: pointer; |
| transition: transform 0.2s, box-shadow 0.2s; |
| margin-top: 15px; |
| } |
| |
| .download-btn:hover { |
| transform: translateY(-2px); |
| box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3); |
| } |
| |
| .download-btn:active { |
| transform: translateY(0); |
| } |
| |
| .formats { |
| display: flex; |
| gap: 10px; |
| margin-top: 15px; |
| flex-wrap: wrap; |
| } |
| |
| .format-btn { |
| flex: 1; |
| min-width: 100px; |
| padding: 12px; |
| background: white; |
| border: 2px solid #667eea; |
| color: #667eea; |
| border-radius: 8px; |
| font-size: 14px; |
| font-weight: 600; |
| cursor: pointer; |
| transition: all 0.2s; |
| text-decoration: none; |
| text-align: center; |
| display: block; |
| } |
| |
| .format-btn:hover { |
| background: #667eea; |
| color: white; |
| transform: translateY(-2px); |
| } |
| |
| .loading { |
| text-align: center; |
| padding: 40px; |
| color: #4a5568; |
| } |
| |
| .spinner { |
| border: 4px solid #f3f4f6; |
| border-top: 4px solid #667eea; |
| border-radius: 50%; |
| width: 40px; |
| height: 40px; |
| animation: spin 1s linear infinite; |
| margin: 0 auto 20px; |
| } |
| |
| @keyframes spin { |
| 0% { transform: rotate(0deg); } |
| 100% { transform: rotate(360deg); } |
| } |
| </style> |
| </head> |
| <body> |
| <div class="container"> |
| <div class="header"> |
| <h1>🎬 Manim Animation</h1> |
| <p>Your rendered mathematical animation is ready!</p> |
| </div> |
|
|
| <div class="video-wrapper"> |
| <video id="video-player" controls autoplay loop> |
| <source id="video-source" src="" type="video/mp4"> |
| Your browser does not support the video tag. |
| </video> |
| </div> |
|
|
| <div class="info"> |
| <div class="info-row"> |
| <span class="info-label">Scene:</span> |
| <span class="info-value" id="scene-name">-</span> |
| </div> |
| <div class="info-row"> |
| <span class="info-label">Quality:</span> |
| <span class="info-value" id="quality">-</span> |
| </div> |
| <div class="info-row"> |
| <span class="info-label">Request ID:</span> |
| <span class="info-value" id="request-id">-</span> |
| </div> |
| <div class="info-row"> |
| <span class="info-label">Expires:</span> |
| <span class="info-value" id="expires">-</span> |
| </div> |
|
|
| <div class="formats" id="download-formats"> |
| |
| </div> |
| </div> |
| </div> |
|
|
| <script> |
| |
| if (window.openai && window.openai.toolOutput) { |
| window.openai.toolOutput.subscribe((data) => { |
| console.log('Received data:', data); |
| updatePlayer(data); |
| }); |
| } |
| |
| |
| window.addEventListener('openai:set_globals', (event) => { |
| console.log('Received globals:', event.detail); |
| if (event.detail) { |
| updatePlayer(event.detail); |
| } |
| }); |
| |
| function updatePlayer(data) { |
| if (!data) return; |
| |
| |
| if (data.urls && data.urls.mp4) { |
| document.getElementById('video-source').src = data.urls.mp4; |
| document.getElementById('video-player').load(); |
| } |
| |
| |
| if (data.scene_name) { |
| document.getElementById('scene-name').textContent = data.scene_name; |
| } |
| if (data.quality) { |
| document.getElementById('quality').textContent = data.quality; |
| } |
| if (data.request_id) { |
| document.getElementById('request-id').textContent = data.request_id; |
| } |
| if (data.expires_at) { |
| const date = new Date(data.expires_at); |
| document.getElementById('expires').textContent = date.toLocaleString(); |
| } |
| |
| |
| if (data.urls) { |
| const formatsDiv = document.getElementById('download-formats'); |
| formatsDiv.innerHTML = ''; |
| |
| for (const [format, url] of Object.entries(data.urls)) { |
| const btn = document.createElement('a'); |
| btn.href = url; |
| btn.className = 'format-btn'; |
| btn.textContent = `Download ${format.toUpperCase()}`; |
| btn.download = `animation.${format}`; |
| btn.target = '_blank'; |
| formatsDiv.appendChild(btn); |
| } |
| } |
| } |
| |
| |
| const urlParams = new URLSearchParams(window.location.search); |
| if (urlParams.has('data')) { |
| try { |
| const data = JSON.parse(decodeURIComponent(urlParams.get('data'))); |
| updatePlayer(data); |
| } catch (e) { |
| console.error('Failed to parse URL data:', e); |
| } |
| } |
| </script> |
| </body> |
| </html> |
|
|