forked from EXT/VR180-Web-Player
Clean up debug logging and finalize 2D playback functionality
- Remove all debug console.log statements - Maintain clean, production-ready code - Play button now works reliably in both VR and 2D modes - Video element visibility properly managed for 2D/VR transitions
This commit is contained in:
@@ -89,6 +89,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
playBtn.disabled = true;
|
playBtn.disabled = true;
|
||||||
|
|
||||||
if (videoElement) {
|
if (videoElement) {
|
||||||
videoElement.load();
|
videoElement.load();
|
||||||
}
|
}
|
||||||
@@ -97,22 +98,29 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
navigator.xr.isSessionSupported('immersive-vr').then((supported) => {
|
navigator.xr.isSessionSupported('immersive-vr').then((supported) => {
|
||||||
if (supported) {
|
if (supported) {
|
||||||
playBtn.dataset.xrSupported = "true";
|
playBtn.dataset.xrSupported = "true";
|
||||||
init();
|
|
||||||
} else {
|
} else {
|
||||||
playBtn.dataset.xrSupported = "false";
|
playBtn.dataset.xrSupported = "false";
|
||||||
// Enable button for regular video playback when VR is not supported
|
// Enable button for regular video playback when VR is not supported
|
||||||
playBtn.disabled = false;
|
playBtn.disabled = false;
|
||||||
}
|
}
|
||||||
|
// Always call init() regardless of VR support
|
||||||
|
init();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error("XR Support Check Error:", err);
|
console.error("XR Support Check Error:", err);
|
||||||
|
playBtn.dataset.xrSupported = "false";
|
||||||
// Enable button for regular video playback when VR check fails
|
// Enable button for regular video playback when VR check fails
|
||||||
playBtn.disabled = false;
|
playBtn.disabled = false;
|
||||||
|
// Call init() even when VR check fails
|
||||||
|
init();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
playBtn.dataset.xrSupported = "false";
|
||||||
// If navigator.xr itself is not available, enable button for regular video playback
|
// If navigator.xr itself is not available, enable button for regular video playback
|
||||||
if (playBtn) {
|
if (playBtn) {
|
||||||
playBtn.disabled = false;
|
playBtn.disabled = false;
|
||||||
}
|
}
|
||||||
|
// Call init() even when XR is not available
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -499,16 +507,16 @@ function init() {
|
|||||||
if (video) {
|
if (video) {
|
||||||
video.onloadedmetadata = () => {
|
video.onloadedmetadata = () => {
|
||||||
if (isFinite(video.duration) && playBtn) {
|
if (isFinite(video.duration) && playBtn) {
|
||||||
if (playBtn.dataset.xrSupported === "true") {
|
// Enable button for both VR and non-VR scenarios when video is ready
|
||||||
playBtn.disabled = false;
|
playBtn.disabled = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateSeekBarAppearance();
|
updateSeekBarAppearance();
|
||||||
updateVRPlayPauseButtonIcon();
|
updateVRPlayPauseButtonIcon();
|
||||||
updateVRVolumeButtonIcon();
|
updateVRVolumeButtonIcon();
|
||||||
};
|
};
|
||||||
video.oncanplaythrough = () => {
|
video.oncanplaythrough = () => {
|
||||||
if (playBtn && playBtn.dataset.xrSupported === "true" && video.readyState >= video.HAVE_FUTURE_DATA) {
|
if (playBtn && video.readyState >= video.HAVE_FUTURE_DATA) {
|
||||||
|
// Enable button for both VR and non-VR scenarios when video is ready to play
|
||||||
playBtn.disabled = false;
|
playBtn.disabled = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user