virtual-background icon indicating copy to clipboard operation
virtual-background copied to clipboard

Does not work with safari browser

Open abhishekprologic opened this issue 2 years ago • 11 comments

Works fine with Chrome and Firefox.

I am using Safari version 15.0. Following errors occur in Safari browser on opening live demo:

[Warning] wasm streaming compile failed: CompileError: WebAssembly.Module doesn't parse at byte 5: can't get Function local's type in group 1, in function at index 19 (tflite-simd.js, line 9)

[Warning] falling back to ArrayBuffer instantiation (tflite-simd.js, line 9)

[Warning] failed to asynchronously prepare wasm: CompileError: WebAssembly.Module doesn't parse at byte 5: can't get Function local's type in group 1, in function at index 16 (tflite-simd.js, line 9)

[Warning] CompileError: WebAssembly.Module doesn't parse at byte 5: can't get Function local's type in group 1, in function at index 16 (tflite-simd.js, line 9)

[Warning] Failed to create TFLite SIMD WebAssembly module. – RuntimeError: abort(CompileError: WebAssembly.Module doesn't parse at byte 5: can't get Function local's type in group 1, in function at index 16). Build with -s ASSERTIONS=1 for more info. (main.0187bf97.chunk.js, line 1)

*RuntimeError: abort(CompileError: WebAssembly.Module doesn't parse at byte 5: can't get Function local's type in group 1, in function at index 16). Build with -s ASSERTIONS=1 for more info. Screenshot 2022-02-02 at 6 56 49 PM *

abhishekprologic avatar Feb 02 '22 13:02 abhishekprologic

This is supposed to be a warning. The demo handles this case and should work fine except that SIMD isn't supported by the browser. As a result, the default backend should be WebAssembly and WebAssembly SIMD should be disabled. image

Volcomix avatar Feb 02 '22 13:02 Volcomix

Not working with any other options too.

abhishekprologic avatar Feb 02 '22 14:02 abhishekprologic

I'm not sure to understand what is not working then. In the screenshot you shared, we can see the background showing up at 60fps and given that no face is on the camera, I can't understand what is going wrong. Please could you share another screenshot with either a face on the camera or either one of the provided images as input?

Volcomix avatar Feb 02 '22 15:02 Volcomix

Screenshot 2022-02-03 at 9 40 36 AM

abhishekprologic avatar Feb 03 '22 04:02 abhishekprologic

Thanks you for taking the time to share this screenshot. The console output is actually interesting. On my Safari 15.2 (no idea if the minor version does matter) where I have it working, the difference I can see is that I don't have this first Promise Rejection error that appears on your screenshot. ~I'm gonna try to deploy a version with more info on all the promise errors to see if it could help the investigation. I'll let you know once it's deployed so that you could do another test if you don't mind.~

Volcomix avatar Feb 04 '22 16:02 Volcomix

Actually I tried to make every promise of the code fail and I didn't manage to reproduce both the face not showing and the background being rendered. So I'm now wondering if there could be an issue when trying to read the pixels from the camera stream. Do you have the same result with the example source images or does it happen only with your camera?

Volcomix avatar Feb 05 '22 11:02 Volcomix

Yes, same results with the images and video. I’m using Safari on Mac Mini.

abhishekprologic avatar Feb 05 '22 11:02 abhishekprologic

Thanks for your answer, I'm gonna investigate differently then.

Volcomix avatar Feb 05 '22 11:02 Volcomix

Same results with https://github.com/spasimir21/camera-processor/tree/main/%40camera-processor/virtual-background

which is based on this library.

abhishekprologic avatar Feb 05 '22 11:02 abhishekprologic

Related issue: https://github.com/spasimir21/camera-processor/issues/5

That's interesting cause it seems that for now, @spasimir21 repo doesn't include yet all the WebGL stuff so I guess I can exclude everything related to this from the root cause.

Volcomix avatar Feb 05 '22 11:02 Volcomix

I don't know if it is related to this issue, but it's related to Safari browsers, booth on web and mobile. If the source video is not shown, the output video will be blocked at the last frame. I managed to overcome this problem, with position absolute, and opacity 0. Hope this helps someone dealing with Safari!

miketm01 avatar Jul 25 '22 10:07 miketm01