Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for offerSession #5410

Merged
merged 7 commits into from
Dec 12, 2023
Merged

Add support for offerSession #5410

merged 7 commits into from
Dec 12, 2023

Conversation

cabanier
Copy link
Contributor

offerSession is a recent addition to WebXR that makes it more obvious that a page can enter WebXR.
Quest browser got feedback that the "Enter VR/AR/XR" buttons on a lot of sites is hard to find.
Often the button is small or scrolled of the bottom of the page. To remedy this, we worked with the W3C Immersive group on a new API that adds a button to the URL bar. This button will launch a pending immersive session.

This change will call offerSession when the page is opened or when the immersive session exits.

cc @dmarcos

@cabanier cabanier marked this pull request as ready for review December 11, 2023 21:54
@@ -150,6 +150,7 @@ module.exports.Component = registerComponent('xr-mode-ui', {
} else {
if (!utils.device.checkVRSupport()) { this.enterVREl.classList.add('fullscreen'); }
this.enterVREl.classList.remove(HIDDEN_CLASS);
sceneEl.enterVR(false, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably handle this a bit differently. Give control to the dev and decide if the page is auto-entering VR. Maybe a property in this component enterImmersiveModeAtPageLoad a tad long but descriptive. open to a shorter alternative. We can then probably handled the sceneEl.enterVR here https://github.com/aframevr/aframe/pull/5410/files#diff-8eae4e9d86bc7d08e7db133212411b40a655722a0d8c42c1c99c45fccef72f74L124 before deciding to display the UI

src/core/scene/a-scene.js Outdated Show resolved Hide resolved
src/core/scene/a-scene.js Outdated Show resolved Hide resolved
src/core/scene/a-scene.js Outdated Show resolved Hide resolved
src/core/scene/a-scene.js Outdated Show resolved Hide resolved
function requestSuccess (xrSession) {
self.xrSession = xrSession;

if (useOfferSession) {
self.usedOfferSession = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably can always set this to false here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without checking useOfferSession

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the regular requestSession API will then also set this to false. At that point we'll be in a bad state because the offersession promise is still pending.

src/core/scene/a-scene.js Outdated Show resolved Hide resolved
@dmarcos dmarcos merged commit fc54fe9 into aframevr:master Dec 12, 2023
1 check passed
@cabanier cabanier deleted the offersession branch December 12, 2023 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants