Video Streaming not working on IOS

I’m trying to stream a video into Unity, it works fine in the Unity editor and in android builds.
When trying it on IOS however I get an error the moment I try start playing the video.
The video gets streamed from Vimeo.
I’ve noticed there where a few other forum post related to this but none of the proposed solution worked.

The error code:
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
SecurityError: The operation is insecure.
texImage2D@[native code]
_JS_Video_UpdateToTexture@blob:https ://goaoi.zappar.io/a1659bc9-8057-40bc-9445-c6f6e71cffed:2:57742
wasm-stub@[wasm code]

<?>.wasm-function[43852]@[wasm code] <?>.wasm-function[44127]@[wasm code] <?>.wasm-function[44165]@[wasm code] <?>.wasm-function[44163]@[wasm code] <?>.wasm-function[44161]@[wasm code] <?>.wasm-function[20371]@[wasm code] <?>.wasm-function[20371]@[wasm code] <?>.wasm-function[20361]@[wasm code] <?>.wasm-function[20353]@[wasm code] <?>.wasm-function[60226]@[wasm code]

wasm-stub@[native code]
@blob:https ://goaoi.zappar.io/a1659bc9-8057-40bc-9445-c6f6e71cffed:2:528169
browserIterationFunc@blob:https ://goaoi.zappar.io/a1659bc9-8057-40bc-9445-c6f6e71cffed:2:176788
runIter@blob:https ://goaoi.zappar.io/a1659bc9-8057-40bc-9445-c6f6e71cffed:2:179853
Browser_mainLoop_runner@blob:https ://goaoi.zappar.io/a1659bc9-8057-40bc-9445-c6f6e71cffed:2:178318

Welcome @andy1 to the group.

So If your are using WebGL then I have some bad news for …
Apple in it’s wisdom blocks videos in WebGL. I found this out after I got my project working and I just happen to test it on my wife’s iPhone.

Now with that said @marks had some WebGL addons he’s selling at Unity Store. Link
One of them is a WebGL video player.

Good luck
Steve

1 Like

Thank you for the reply Steve.

With the plugin I can get the provided videos from the demo scene streaming but when streaming from Vimeo we still get a similar error. The audio however does start playing. Is there a known fix for this or a video streaming platform that does work?

The error:
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
SecurityError: The operation is insecure.
texImage2D@[native code]
_VideoPlayerWebGL_UpdateTexture@blob:https ://goaoi.zappar.io/b1f84d26-9231-490b-95a2-bb9e4e8bb090:102:72059
wasm-stub@[wasm code]

<?>.wasm-function[73912]@[wasm code] <?>.wasm-function[73918]@[wasm code] <?>.wasm-function[62140]@[wasm code] <?>.wasm-function[59771]@[wasm code] <?>.wasm-function[59192]@[wasm code] <?>.wasm-function[9481]@[wasm code] <?>.wasm-function[9479]@[wasm code] <?>.wasm-function[1075]@[wasm code] <?>.wasm-function[20233]@[wasm code] <?>.wasm-function[20239]@[wasm code] <?>.wasm-function[20206]@[wasm code] <?>.wasm-function[24280]@[wasm code] <?>.wasm-function[24279]@[wasm code] <?>.wasm-function[20958]@[wasm code] <?>.wasm-function[20398]@[wasm code] <?>.wasm-function[20398]@[wasm code] <?>.wasm-function[20388]@[wasm code] <?>.wasm-function[20380]@[wasm code] <?>.wasm-function[60421]@[wasm code]

wasm-stub@[native code]
@blob:https ://goaoi.zappar.io/b1f84d26-9231-490b-95a2-bb9e4e8bb090:102:546533
browserIterationFunc@blob:https ://goaoi.zappar.io/b1f84d26-9231-490b-95a2-bb9e4e8bb090:102:188957
runIter@blob:https ://goaoi.zappar.io/b1f84d26-9231-490b-95a2-bb9e4e8bb090:102:192022
Browser_mainLoop_runner@blob:https ://goaoi.zappar.io/b1f84d26-9231-490b-95a2-bb9e4e8bb090:102:190487

Sorry This one would be a @marks question.

I’ll let him help you with it.

Steve

Vimeo and youtube videos are not supported because they don’t provide direct links to the video. My plugin supports playing videos from CDNs such as AWS. I believe Vimeo has a premium option where you can get a direct link to the video, however.

If you already have a direct link to the video, make sure you are using the pointerdown event as described in the documentation, and make sure Vimeo has CORS configured correctly.

Upon further researching your error, it seems that the issue is that Safari can’t handle CDN redirects. Following what the SO post says, try to inspect the network tab and get the URL of the video after the redirection. That URL should work on Safari as well.

1 Like

Thanks for your reply Marks

We are indeed using the direct video link and the pointerdown event.
It seemed that it had indeed something to do with CORS. After setting up https://github.com/Rob--W/cors-anywhere we are able to get it to work.

1 Like