iOS Issues

My app runs fine on Desktop and Android, but on iPhone 12,13 and 14 I have lots of issue eg… Streamed video isn’t playing, UI buttons appear/disappear randomly, UI audio toggle doesn’t work, Security errors in console.
I’ve noticed its using quite a bit of VRAM (`350 Mb) but it still seems fine on other devices.

Does anyone know what to problem/s could be and why they are only affecting iOS?

Thanks

Hi @Grimmy,

That’s a lot of issues and difficult to debug out of context. Try to break your issues and do a search on the forums, iOS can be quite special it’s true.

Some examples out of the blue:

  1. Video playback on iOS needs the muted flag to start automatically. Otherwise it requires user interaction.

  2. UI buttons, I have no idea about that, share more info please.

  3. Playing audio, not sure, make sure that you interact with a UI element before playing audio, and do check the file format of your audio files.

350MB for VRAM usage can be quite a lot on iOS, but if your page isn’t crashing then that’s not an issue.

Cheers. Well the first issue seems to be this security error that is making the UI vanish and re-appear. you’ll also notice a bunch of textures also vanish from the plants.

This seems to be when a video screen ‘should’ come into view. It is fixed to the wall on the left. On iPhone the screen is not visible. The video screen is streaming content from the web which works fine on other devices.

Here is a video of the issue: [Dropbox - ios_securty error.mp4 - Simplify your life](https://iOS Security Error)

You can see that the UI disappears when the error appears and re-reappears if I turn in another direction.

Remember, this issue is only on iPhone as far as I can tell.

EDIT: Seems to be a CORS issue I tried using ‘CORS Anywhere’ from https://cors-anywhere.herokuapp.com/ . After a few tries with just the demo the video now seems to be working on device…but then not…strange things happening. Will update.

Well streaming video using CORS Anywhere seems to be okay but streaming sound does not play. (Uncaught (in promise) DOMException: The element has no supported sources.) Maybe a limitation of the library? I have no idea but its useless as it is. Is there a better solution?

Worth noting that the Video is hosted on Vimeo so I have no way to change CORS policies in any way. What can I do?

Ok, when I host the videos on my own server specifically for iOS the videos playback but the sound doesnt run.The sound.src is set to exactly the same src as the video url. I get the following error:

Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

Any idea on that one? Cheers :slight_smile:

This is what ChatGPT has to say:

If you want to use your own video player instead of relying on the Vimeo player, you may encounter CORS (Cross-Origin Resource Sharing) issues when trying to stream the video directly from the Vimeo servers. CORS policies are enforced by web browsers to restrict cross-origin requests, which includes fetching resources from a different domain.

By default, Vimeo does not allow cross-origin requests for video files, which means you cannot directly stream the video content using your own video player unless you have special permissions or access through Vimeo’s API.

To work around this limitation, Vimeo provides an API called the Vimeo Player API, which allows you to control the Vimeo player programmatically and access video information. With this API, you can retrieve the video files and stream them using your own video player.

Here are the general steps you can follow:

Sign up for a Vimeo API access token by creating a Vimeo app and obtaining the necessary credentials.

Use the Vimeo Player API to fetch the video files associated with the Vimeo video. The API provides endpoints to retrieve information about the video, including the available video files.

Once you have obtained the video files’ URLs from the API response, you can pass those URLs to your custom video player for streaming.

Keep in mind that using the Vimeo Player API and streaming the video through your own player requires additional development effort and might have some limitations depending on the permissions and access granted by Vimeo.

You can refer to Vimeo’s API documentation for more details on using their Player API and accessing video files programmatically: Vimeo

OKay Thanks. Before going down that route it might be faster to simply host video for iOS elsewhere. With that in mind do you have any idea why the sound wouldn’t be allowed to play from my server but the video itself IS allowed?