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;
|
||||
|
||||
if (videoElement) {
|
||||
videoElement.load();
|
||||
}
|
||||
@@ -97,22 +98,29 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
navigator.xr.isSessionSupported('immersive-vr').then((supported) => {
|
||||
if (supported) {
|
||||
playBtn.dataset.xrSupported = "true";
|
||||
init();
|
||||
} else {
|
||||
playBtn.dataset.xrSupported = "false";
|
||||
// Enable button for regular video playback when VR is not supported
|
||||
playBtn.disabled = false;
|
||||
}
|
||||
// Always call init() regardless of VR support
|
||||
init();
|
||||
}).catch(err => {
|
||||
console.error("XR Support Check Error:", err);
|
||||
playBtn.dataset.xrSupported = "false";
|
||||
// Enable button for regular video playback when VR check fails
|
||||
playBtn.disabled = false;
|
||||
// Call init() even when VR check fails
|
||||
init();
|
||||
});
|
||||
} else {
|
||||
playBtn.dataset.xrSupported = "false";
|
||||
// If navigator.xr itself is not available, enable button for regular video playback
|
||||
if (playBtn) {
|
||||
playBtn.disabled = false;
|
||||
}
|
||||
// Call init() even when XR is not available
|
||||
init();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -499,16 +507,16 @@ function init() {
|
||||
if (video) {
|
||||
video.onloadedmetadata = () => {
|
||||
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;
|
||||
}
|
||||
}
|
||||
updateSeekBarAppearance();
|
||||
updateVRPlayPauseButtonIcon();
|
||||
updateVRVolumeButtonIcon();
|
||||
};
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user