Setting COOP, COEP from streamlit server side?

Hello,
I’m trying to implement custom component which deals with video.
Inside that custom component, I use ffmpeg.wasm .
This module uses SharedArrayBuffer which causes error while loading / parsing the video saying

ReferenceError: SharedArrayBuffer is not defined

So I looked up what it means and I ended up on this link saying that I should make a page cross-origin isolated by serving the page with these headers

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

How do I achieve this with streamlit?

I tried

streamlit run my_app.py \
--server.enableCORS false \
--server.enableXsrfProtection false

but no luck. (I set it false because the default value was true… but seems like setting it as true makes more sense)

Above options were only options that I could find in config.

1 Like