model-viewer: QuickLook broken on visionOS, does not open generated USDZ blobs
Description
Looks like iOS 17 has changed something about how dynamically generated USDZ files are treated, and as a consequence the AR conversion of model-viewer breaks.
Edit: From my tests, it looks like when the file extension is missing (such as when using a blob URL from URL.createObjectUrl
) QuickLook immediately closes or, in some cases, crashes Safari.
Live Demo
- Open https://model-viewer.dev on iOS 17 or iPadOS 17 in Safari
- Click the AR button of the Astronaut
- Observe that QuickLook opens for a split second and then immediately closes again
- Note that downloading that very USDZ file and providing it as custom USDZ src works! So the file itself is fine, something about the handoff to QuickLook seems to be not. My gut feel would be that the blob URL doesn’t work but an actual file with extension does.
- Note that it works in Chrome, only Safari seems to be affected
Bug Reports
- Feedback FB12578739 (for iOS / iPadOS)
- Feedback FB12487017 (for visionOS Simulator)
- WebKit https://bugs.webkit.org/show_bug.cgi?id=259141
Version
latest
Browser Affected
- Chrome
- Edge
- Firefox
- IE
- Safari
OS
- Android
- iOS 17 / iPadOS 17 / visionOS
- Linux
- MacOS
- Windows
AR
- WebXR
- SceneViewer
- QuickLook
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 45 (23 by maintainers)
@vortice3D if it only happens with your webserver I recommend checking the mime type of the served files, QuickLook is picky about those being correct (and maybe got even more picky).
It looks like your server serves the file as
application/octet-stream
but it needs to bemodel/vnd.reality
as it is on @milesgreen server.So make sure your server returns .reality as
model/vnd.reality
and .usdz asvnd.usdz+zip
.Thanks @milesgreen, I’m very happy to confirm that iOS 17 Dev Beta 6 fixes the issue. It’s still not working on visionOS (in the simulator at least), so I’ll keep the issue open until that is hopefully fixed too, but looks like we’re on a good way.
Looks like Dean is already on it with a fix in the works:
https://bugs.webkit.org/show_bug.cgi?id=258957
@hybridherbst Ah, yes, you are right. Switching to CSS style color specs, or adding the extra A parameter to the array, both resolved the problem. Thanks!
FWIW, I was working from the example here: https://modelviewer.dev/examples/scenegraph/#pickMaterialExample, which includes the line:
material.pbrMetallicRoughness. setBaseColorFactor([Math.random(), Math.random(), Math.random()]);
Also, the 3-parameter version does seem to work the way I expected it to everywhere except in the USDZ QuickLook conversion, so that’s why I thought it was a problem with the conversion.
Good evening, @hybridherbst and @milesgreen:
It’s really curious, but the case is walking back to home, after writing to you my last response at office, I was thinking about all this and suddenly the MIME stuff came to my mind (walking and explaining to your rubber duck are the best for solve software developing problems). It have all the sense.
So, as soon as I get home, I just opened my Plesk and updated Apache/nginx settings, adding the aforementioned types: model/vnd.usdz+zip .usdz model/vnd.reality .reality
Now it’s working fine, as you can check.
Again, thank you very much for your help on this issue.
Best regards.
We’re seeing the rel=“ar” links failing on iOS 17 production release. Previously working links are now failing with the “Object requires a newer version of iOS”. A simple <a href… works.
<a href="myFile.reality"> <img src="myPreviewImage.png"> </a>
But it opens the ugly AR preview before going into the AR itself.
I really wish Apple would stop mucking around with this stuff.
Yes, should be three r154. I tested a couple of things today, trying to see if there’s something that can be fixed in three in the meantime:
I also went through and compared how three and model-viewer launch QuickLook with blobs and it looks like it’s identical (rel=“ar” is there, download=“model.usdz” is there, the a has an img child, …). Can’t find a meaningful difference. Resulting USDZ files seem to be mostly identical too.
@hybridherbst Right–I wasn’t suggesting that the conversion be modified to try to cover for omitted A channel, but maybe the examples should be updated so they don’t include code that makes this omission. There are a few spots in the example code that use this function with only 3 parameters instead of 4.
@elalish I think this is actually a bug in or incorrect usage of model-viewer: When using
setBaseColorFactor([0,1,1])
it looks like the opacity value is set to undefined here:I don’t think that’s allowed / expected to work.
I think @hybridherbst is right on the money.
To sanity check though, @vortice3D, I see your sample link breaks in iOS 17.2 beta, but does indeed work in iOS 16.6.1.
Also, both our links work in iOS 16.6.1
So if it is mime types, then those must have become stricter in iOS17
Let us know if updating mime type solves it.
@vortice3D - do you have a repro link to test?
I just made a Glitch that opens a copy of the Apple Cosmonaut reality file here:
https://arql-reality-test.glitch.me/
I’m testing in iOS 17.2 beta (21C5029g) and this opens fine for me.
Does the above link work for you?
is any one facing same issue still? Even after updating to iOS 17 stable version
Just tested with the very latest iOS 17 Dev Beta 5 (21A5303d), and this issue now appears to be fixed. I have tried a number of USDZ blob scenarios and so far they are all working as expected. So it looks like this fix (https://bugs.webkit.org/show_bug.cgi?id=258957) is in the build and should launch with iOS17 public release.
Updated the issue title to mention blobs and added the WebKit bug link in the post, too. @milesgreen thanks for opening the WebKit issue! You may want to add that the issue also reproduces in iPadOS and visionOS (in the simulator)
Reported on WebKit Bugzilla too, to cover all bases. https://bugs.webkit.org/show_bug.cgi?id=259141
@meshula Looks like QuickLook broke again. Any ideas regarding whether this is intentional or can be worked around or is planning to be fixed before release? @grorg too - hoping we can get a fix in before Safari’s branch cut this time?