Loading objectUrl of video blob in content script refused due to content security

125 views
Skip to first unread message

Bala Abhinav

unread,
Jun 20, 2024, 6:38:50 AMJun 20
to Chromium Extensions
Hello,

I am building an extension on MV3 where I record video using the mediaDevices API in an offscreen document and display it on the page using a video element in my content script. I am using URL.createObjectURL to generate the url in the offscreen document before passing it onto the content script but I am getting a content security error (attached below) : 
Refused to load media from 'blob:blob-url' because it violates the following Content Security Policy directive: "media-src 'self' archive.org 

Is there a chrome extension "native" way of making this work or should I go for the "iframe" hack described in one of the other conversation threads ? Any other solutions are welcome. 

Thanks

woxxom

unread,
Jun 20, 2024, 10:11:39 AMJun 20
to Chromium Extensions, Bala Abhinav
Normally it should just work, so I guess it's a bug in Chrome or your content script uses MAIN world? Re-create the blob URL in a normal content script in the default world like URL.createObjectURL(await (await fetch(blobUrl)).blob()) and then use dispatchEvent (example).
Reply all
Reply to author
Forward
0 new messages