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

Support extended AR QuickLook parameters when auto generating USDZ blob #3434

Merged
merged 3 commits into from
May 13, 2022

Conversation

milesgreen
Copy link
Contributor

@milesgreen milesgreen commented May 9, 2022

Reference Issue

#3425

Approach

This change allows extended AR QuickLook parameters (EG custom, checkoutTitle, checkoutSubtitle, etc) to be appended after the src path as # hash fragment when using auto USDZ generation and there is no ios-src property.

Any / all defined # params get appended to USDZ blob without discrimination (AR QuickLook will ignore any invalid params).

Usage

Define src as something like:
https://example.com/model.gltf#custom=path-to-banner.html
Omit ios-src
Include "quick-look" in ar-modes to trigger auto USDZ generation.
When opening AR on iOS, USDZ will be auto generated and displayed with custom banner in AR.

Tests

Two tests created:

  • replicate src hash to usdz blob url
  • replicate src hash to usdz blob and set hash for fixed scale

Demo

https://modelviewer-auto-usdz-params.glitch.me/

Compatibility

Note that passing # params after blob url only works in Safari iOS 15.5 beta 4 onwards. Prior to that, passing # params after blob url were either ignored (https://bugs.webkit.org/show_bug.cgi?id=226265) or caused model to never load (https://bugs.webkit.org/show_bug.cgi?id=236069).

@milesgreen
Copy link
Contributor Author

@elalish - please let me know if you'd like me to tackle in a different way.

I couldn't manage to get the unit test working though :(

Copy link
Contributor

@elalish elalish left a comment

Choose a reason for hiding this comment

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

Thanks! See, that wasn't so bad, was it? 😁

packages/model-viewer/src/test/features/ar-spec.ts Outdated Show resolved Hide resolved
packages/model-viewer/src/features/ar.ts Show resolved Hide resolved
@elalish elalish marked this pull request as ready for review May 10, 2022 15:58
Copy link
Contributor

@elalish elalish left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! I marked this as ready for review, because I think it's all done now, right?

@milesgreen
Copy link
Contributor Author

Right. I think that's it...! If you're happy, I'm happy.

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