1
0

Implement custom SVG play button with enhanced UX

- Replace text button with beautiful SVG play button
- Position button over center of video with responsive sizing
- Add smooth hover and click animations
- Hide button after click and enable native browser controls for 2D
- Maintain VR functionality when supported
- Add proper accessibility with aria-label
- Responsive design works on mobile and desktop
This commit is contained in:
Michael Verdi
2025-07-30 10:26:18 -05:00
parent eaab4ee3ba
commit 45e1617ca3
2 changed files with 84 additions and 2 deletions

View File

@@ -688,6 +688,18 @@ function onWindowResize() {
}
}
function hidePlayButton() {
if (playBtn) {
playBtn.classList.add('hidden');
}
}
function enableNativeControls() {
if (video) {
video.controls = true;
}
}
function togglePlayPause() {
if (!video || !video.currentSrc) return;
if (video.paused || video.ended) {
@@ -771,12 +783,16 @@ async function handleEnterVRButtonClick() {
return;
}
// Hide the play button after click
hidePlayButton();
// Check if VR is supported
if (playBtn.dataset.xrSupported === "true") {
// VR is supported - use VR functionality
await actualSessionToggle();
} else {
// VR is not supported - use regular video playback
// VR is not supported - use regular video playback and enable native controls
enableNativeControls();
togglePlayPause();
}
}