ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
13.49k stars 775 forks source link

Because your site has the Cross-Origin Embedder Policy enabled, each embedded iframe must also specify this policy #614

Open CrypticSignal opened 8 months ago

CrypticSignal commented 8 months ago

Next.js 13 app deployed using Amplify: https://main.d2hzcewjwit905.amplifyapp.com

When trying to convert a file, a request is made to https://main.d2hzcewjwit905.amplifyapp.com/_next/static/chunks/795.ceab62a43c56068c.js which gives the following error:

image

I'm not sure how to resolve this. I have set Cross-Origin-Embedder-Policy to require-corp for all paths in next.config.js (unless source: "/(.*)" doesn't match all paths? I tried source: "/" too and got the same issue).

async headers() {
    return [
      {
        source: "/(.*)",
        headers: [
          {
            key: "Cross-Origin-Embedder-Policy",
            value: "require-corp",
          },
          {
            key: "Cross-Origin-Opener-Policy",
            value: "same-origin",
          },
          {
            key: "Access-Control-Allow-Origin",
            value: "*",
          },
        ],
      },
    ];
  },

The source code for my project which includes my next.config.js file can be found here: https://github.com/CrypticSignal/av-converter-amplify

Reproduction steps

  1. Go to https://main.d2hzcewjwit905.amplifyapp.com
  2. Open devtools and go to the network tab
  3. Try to convert a file
  4. After a few seconds, you should see a request being made to https://main.d2hzcewjwit905.amplifyapp.com/_next/static/chunks/795.ceab62a43c56068c.js and the error in the screenshot above.

    • OS: Windows 11
    • Browser: Chrome v117.0.5938.149 (Official Build) (64-bit)
mok419 commented 4 months ago

I was having the issue described but when I changed next config to path you used "/(.*)" the error disappeared!

I also had a look at how you are loading the ffmpeg files and looks like we are doing the same!

The issue I have now is the multithread version is slower than the single thread version lol

mok419 commented 4 months ago

I never ended up using this as it crashes on mobile devices for my use case.

I also noticed the multithread url has an extra -mt i didn't notice, but not much improvement seen!

Let me know if you want the source code i had working!