diff --git a/ui/externs/ui.js b/ui/externs/ui.js index 9bc364855..5efd6e248 100644 --- a/ui/externs/ui.js +++ b/ui/externs/ui.js @@ -228,6 +228,7 @@ shaka.extern.UIShortcuts; * menuOpenUntilUserClosesIt: boolean, * allowTogglePresentationTime: boolean, * showRemainingTimeInPresentationTime: boolean, + * enableVrDeviceMotion: boolean, * }} * * @property {!Array} controlPanelElements @@ -483,6 +484,11 @@ shaka.extern.UIShortcuts; * Show remaining time of presentation time by default, when playing a VOD. *
* Defaults to false. + * @property {boolean} enableVrDeviceMotion + * Enables or disables the device motion for VR videos. + *
+ * Defaults to true except on Vision OS where the default value + * is false * @exportDoc */ shaka.extern.UIConfiguration; diff --git a/ui/ui.js b/ui/ui.js index a3e2fa7bc..1859289e8 100644 --- a/ui/ui.js +++ b/ui/ui.js @@ -419,6 +419,7 @@ shaka.ui.Overlay = class { menuOpenUntilUserClosesIt: true, allowTogglePresentationTime: true, showRemainingTimeInPresentationTime: false, + enableVrDeviceMotion: true, }; // On mobile, by default, hide the volume slide and the small play/pause @@ -477,6 +478,11 @@ shaka.ui.Overlay = class { (name) => !filterElements.includes(name)); } + const device = shaka.device.DeviceFactory.getDevice(); + if (device.getDeviceType() == shaka.device.IDevice.DeviceType.APPLE_VR) { + config.enableVrDeviceMotion = false; + } + return config; } diff --git a/ui/vr_manager.js b/ui/vr_manager.js index 0ad76497f..c4c4297e3 100644 --- a/ui/vr_manager.js +++ b/ui/vr_manager.js @@ -467,8 +467,8 @@ shaka.ui.VRManager = class extends shaka.util.FakeEventTarget { } // Detect device movement - let deviceOrientationListener = false; - if (window.DeviceOrientationEvent) { + if (this.config_.enableVrDeviceMotion && window.DeviceOrientationEvent) { + let deviceOrientationListener = false; // See: https://dev.to/li/how-to-requestpermission-for-devicemotion-and-deviceorientation-events-in-ios-13-46g2 if (typeof DeviceMotionEvent.requestPermission == 'function') { const userGestureListener = () => {