|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | + <title>AirPlay Test - Video.js Remote Playback Plugin</title> |
| 7 | + <!-- Video.js CSS from CDN for dev server --> |
| 8 | + <link href="https://vjs.zencdn.net/7.19.0/video-js.css" rel="stylesheet"> |
| 9 | + <!-- Plugin CSS served from dist --> |
| 10 | + <link href="/videojs-remoteplayback.css" rel="stylesheet"> |
| 11 | + <style> |
| 12 | + body { |
| 13 | + font-family: Arial, sans-serif; |
| 14 | + max-width: 800px; |
| 15 | + margin: 0 auto; |
| 16 | + padding: 20px; |
| 17 | + } |
| 18 | + .info { |
| 19 | + background: #e3f2fd; |
| 20 | + padding: 15px; |
| 21 | + border-radius: 5px; |
| 22 | + margin: 20px 0; |
| 23 | + } |
| 24 | + .video-container { |
| 25 | + margin: 20px 0; |
| 26 | + } |
| 27 | + </style> |
| 28 | +</head> |
| 29 | +<body> |
| 30 | + <div class="video-container"> |
| 31 | + <video |
| 32 | + id="airplay-test-player" |
| 33 | + class="video-js vjs-default-skin" |
| 34 | + controls |
| 35 | + preload="auto" |
| 36 | + width="640" |
| 37 | + height="360" |
| 38 | + data-setup="{}"> |
| 39 | + <source src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4"> |
| 40 | + <p class="vjs-no-js"> |
| 41 | + To view this video please enable JavaScript, and consider upgrading to a web browser that |
| 42 | + <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>. |
| 43 | + </p> |
| 44 | + </video> |
| 45 | + </div> |
| 46 | + |
| 47 | + <!-- Video.js from CDN for dev server --> |
| 48 | + <script src="https://vjs.zencdn.net/7.19.0/video.min.js"></script> |
| 49 | + <!-- Plugin JS served from dist --> |
| 50 | + <script src="/videojs-remoteplayback.umd.js"></script> |
| 51 | + <script> |
| 52 | + // Debug: Check what's available |
| 53 | + console.log('π Available globals:', Object.keys(window).filter(key => key.includes('Video'))); |
| 54 | + console.log('π VideoJsRemotePlayback:', typeof VideoJsRemotePlayback); |
| 55 | + |
| 56 | + // Initialize the plugin |
| 57 | + if (typeof VideoJsRemotePlayback === 'function') { |
| 58 | + VideoJsRemotePlayback(videojs); |
| 59 | + } else { |
| 60 | + console.error('β VideoJsRemotePlayback is not available as a global function'); |
| 61 | + } |
| 62 | + |
| 63 | + // Create the player |
| 64 | + const player = videojs('airplay-test-player', { |
| 65 | + fluid: true, |
| 66 | + responsive: true |
| 67 | + }); |
| 68 | + |
| 69 | + // Add click event listener to test button functionality |
| 70 | + player.ready(() => { |
| 71 | + setTimeout(() => { |
| 72 | + const airplayButton = document.querySelector('.vjs-airplay-button'); |
| 73 | + if (airplayButton) { |
| 74 | + airplayButton.addEventListener('click', () => { |
| 75 | + console.log('π― AirPlay button clicked!'); |
| 76 | + console.log('π Player airPlay manager:', player.airPlay); |
| 77 | + }); |
| 78 | + console.log('β
Added click listener to AirPlay button'); |
| 79 | + } |
| 80 | + }, 200); |
| 81 | + }); |
| 82 | + |
| 83 | + // Check for duplicate icons |
| 84 | + player.ready(() => { |
| 85 | + setTimeout(() => { |
| 86 | + const airplayButton = player.el().querySelector('.vjs-airplay-button'); |
| 87 | + if (airplayButton) { |
| 88 | + const iconPlaceholders = airplayButton.querySelectorAll('.vjs-icon-placeholder'); |
| 89 | + console.log('π Icon placeholders found:', iconPlaceholders.length); |
| 90 | + console.log('β
Should be exactly 1 icon placeholder'); |
| 91 | + console.log('Button HTML:', airplayButton.outerHTML); |
| 92 | + |
| 93 | + if (iconPlaceholders.length === 1) { |
| 94 | + console.log('π SUCCESS: Only 1 icon placeholder - duplication fixed!'); |
| 95 | + |
| 96 | + // Check if using the correct SVG icon |
| 97 | + const iconStyle = window.getComputedStyle(iconPlaceholders[0]); |
| 98 | + const backgroundImage = iconStyle.backgroundImage; |
| 99 | + console.log('π Background image URL:', backgroundImage); |
| 100 | + |
| 101 | + if (backgroundImage.includes('ic_airplay_white_24px.svg')) { |
| 102 | + console.log('β
Using correct AirPlay SVG icon compiled from SCSS via Vite!'); |
| 103 | + console.log('π― Icon is loaded from bundled images (built with the plugin)'); |
| 104 | + console.log('π¦ CSS compiled from styles/airplay.scss via Vite build process'); |
| 105 | + |
| 106 | + // Try to determine the actual path |
| 107 | + if (backgroundImage.includes('dist/images/')) { |
| 108 | + console.log('π Icon path: dist/images/ic_airplay_white_24px.svg'); |
| 109 | + } else if (backgroundImage.includes('images/')) { |
| 110 | + console.log('π Icon path: images/ic_airplay_white_24px.svg'); |
| 111 | + } |
| 112 | + } else { |
| 113 | + console.log('β οΈ Icon might not be loading from the correct path'); |
| 114 | + console.log('Background image:', backgroundImage); |
| 115 | + } |
| 116 | + } else { |
| 117 | + console.log('β ISSUE: Found', iconPlaceholders.length, 'icon placeholders'); |
| 118 | + } |
| 119 | + } else { |
| 120 | + console.log('β AirPlay button not found (correct for non-Safari browsers)'); |
| 121 | + } |
| 122 | + }, 100); |
| 123 | + }); |
| 124 | + </script> |
| 125 | +</body> |
| 126 | +</html> |
0 commit comments