FFmpegBlazor: JSException: SharedArrayBuffer is not defined

i’m not sure if it’s somehow related with #6 but there i get the following error if i want to use FFmpegBlazor in my WebAssembly project. I noticed that there is a JSException on the hosted version on netlify as well. i’m testing https://ffmpegblazor.netlify.app/tomp3

Microsoft.JSInterop.JSException: SharedArrayBuffer is not defined
ReferenceError: SharedArrayBuffer is not defined
    at blob:https://localhost:5011/8b279815-9592-46f1-806c-a92e17d96ca7:22:175
    at https://unpkg.com/@ffmpeg/ffmpeg@0.10.0/dist/ffmpeg.min.js:1:7334
    at f (https://unpkg.com/@ffmpeg/ffmpeg@0.10.0/dist/ffmpeg.min.js:1:12320)
    at Generator._invoke (https://unpkg.com/@ffmpeg/ffmpeg@0.10.0/dist/ffmpeg.min.js:1:12108)
    at Generator.next (https://unpkg.com/@ffmpeg/ffmpeg@0.10.0/dist/ffmpeg.min.js:1:12745)
    at i (https://unpkg.com/@ffmpeg/ffmpeg@0.10.0/dist/ffmpeg.min.js:1:5052)
    at c (https://unpkg.com/@ffmpeg/ffmpeg@0.10.0/dist/ffmpeg.min.js:1:5255)
   at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[Microsoft.JSInterop.Infrastructure.IJSVoidResult, Microsoft.JSInterop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext()
   at Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference jsObjectReference, String identifier, Object[] args)
   at FFmpegBlazor.FFMPEG.Load(Boolean triggerEvents)

i’m happy to provide more info if needed. Thank you

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 15 (6 by maintainers)

Most upvoted comments

@Heartnett Another alternative is to build project then use 3rd party local web server which can serve wasm files and allows you to add headers with web request ie. add these :

Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin

That should be resolved in .NET 7 when they deliver Multi threading support in blazor wasm . Currently not sure about Kestrel , didn’t find anything useful.

thank you both 🙌 closing the issue now!

You’re welcome, I thank you too for the beautiful project.

@aokocax thank you so much, this will help me so much, i asked the same question on aspnetcore dotnet/aspnetcore#38327 unfortunately was not able to find any pointers in the same direction…

@aokocax thank you so much, this will help me so much, i asked the same question on aspnetcore https://github.com/dotnet/aspnetcore/issues/38327 unfortunately was not able to find any pointers in the same direction…

Those who want to test it quickly on their local computer can add a web.config file to their project and run the project with IISExpress. image

<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <httpProtocol> <customHeaders>

<add name="Cross-Origin-Embedder-Policy" value="require-corp"/> <add name="Cross-Origin-Opener-Policy" value="same-origin"/>

</customHeaders> </httpProtocol> </system.webServer> </configuration>

thank you very much for your quick reply 👏 i will check the self-host branch and see how i can implement it for my usecase