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

chore: Swap webvr to webxr polyfill packages #273

Open
wants to merge 77 commits into
base: main
Choose a base branch
from

Conversation

kevleyski
Copy link
Contributor

@kevleyski kevleyski commented Dec 20, 2022

Description

Fixes #216 (WebXR support)

Specific Changes proposed

For devices that support WebXR use that
Add iOS device orientation permission check on entering 360 (note ESLint workaround as this is iOS Safari specfic)
Fall back to original WebVR polyfill if navigator.xr not available after initialising WebXR polyfill

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Unit Tests updated or fixed
    • Docs/guides updated
  • Reviewed by Two Core Contributors

Kevin Staunton-Lambert and others added 25 commits December 2, 2022 13:51
…w Device API is more likely the better thing to do though
[KJSL] Swap webvr ro webxr polyfill packages
[KJSL] Swap webvr ro webxr polyfill packages
[KJSL] Add WebXR immersive VR support
chore: Swap webvr ro webxr polyfill packages
…olyfill if webxr immersive is not available)
chore: Swap webvr ro webxr polyfill packages (continue to use webvr p…
… operation to play/pause and exit VR/AR session)
chore: Swap webvr for webxr polyfill packages (adding basic controller…
chore: Swap webvr ro webxr polyfill packages
chore: Swap webvr to webxr polyfill packages
@kevleyski
Copy link
Contributor Author

Had planned to add thinks like thumb stick controls scrubbing rate maybe and throw a TV not your AR wall - but then those can be a separate issue items

This is more a quick fix to get the player playing immersive VR

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

OMG, thank you so much for this! Been highly requested for sure.

Had a couple of questions.

CONTRIBUTING.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/big-vr-play-button.js Outdated Show resolved Hide resolved
@@ -1,6 +1,8 @@
import 'babel-polyfill';
Copy link
Member

Choose a reason for hiding this comment

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

What is babel-polyfill needed for here? Since this is a library, we generally prefer not including polyfills, requesting users include it on their page themselves.
Also, should this be using @babel/polyfill as it's newer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seemed to be a dependency of webxr polyfill - I'll recheck

Copy link
Member

Choose a reason for hiding this comment

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

Seems like it isn't required https://github.com/immersive-web/webxr-polyfill#browser-support

I think we should make a note of it in the README, but otherwise leave it out of the bundle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok so I tried pulling it out this results in the WebXR sessions not starting because there is some regenerator code not generated without babel-polyfill
I encourage other to help remove it if its a concern, I'm out of cycles today

Copy link
Member

Choose a reason for hiding this comment

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

going to "unresolve" this just so that it doesn't get lost, but I don't think it's a blocker.

Comment on lines +724 to +725
// Detect WebXR is supported
if (window.navigator.xr) {
Copy link
Member

Choose a reason for hiding this comment

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

🎉

src/plugin.js Outdated Show resolved Hide resolved
if (window.navigator.xr) {
this.log('WebXR is supported');
window.navigator.xr.isSessionSupported('immersive-vr').then((supportsImmersiveVR) => {
if (supportsImmersiveVR) {
Copy link
Member

Choose a reason for hiding this comment

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

if this is false should we try and fall back to the WebVRPolyfill? Or does it happen automatically? A bit hard to understand since it's asynchronous.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I went through a few permutations of that - after testing it seemed to not really matter
Then again could be getting lucky in timing each time

src/plugin.js Outdated
}

// No WebXR support fall back to using WebVR polyfill
if (!hasWebXR) {
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't this always get set up regardless of whether webXR is available? Since hasWebXR will always be false here as it hasn't been set to true in the promise above.

kevleyski and others added 2 commits December 21, 2022 04:01
Co-authored-by: Gary Katsevman <[email protected]>
src/plugin.js Outdated Show resolved Hide resolved
Kevin Staunton-Lambert and others added 10 commits January 30, 2023 10:50
chore: Swap webvr for webxr polyfill packages (PR fix ups - fix up VR fall back if no WebXR)
chore: Swap webvr for webxr polyfill packages (PR fix ups - fix up 180 Left/Right)
chore: Swap webvr for webxr polyfill packages (PR fix ups - cubemap)
chore: Swap webvr for webxr polyfill packages (PR fix ups - cubemap better precision for headsets)
@alex-barstow alex-barstow changed the title chore: Swap webvr ro webxr polyfill packages chore: Swap webvr to webxr polyfill packages Feb 1, 2023
@kevleyski
Copy link
Contributor Author

Not entirely sure where package-lock.json came from
(anyhow my local merge was ok without conflicts)

@mister-ben
Copy link

It's a shame this stalled, would be great to get all this work in. Is it just package-lock that needs to be fixed up?

@mister-ben
Copy link

I've a branch here with these changes merged onto main, https://github.com/mister-ben/videojs-vr/tree/from-metacdn

@mister-ben mister-ben mentioned this pull request Dec 8, 2023
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.

are you planning to move from webVR to WebXR ?
3 participants