download video with fetch api
Answeredhello,
I configured Nx so that every time my camera detected movement, a bookmark would be created.
On my website I am displaying that video with the Direct Download api like this:
.../hls/8e381942-ee6a-b4e1-5108-6d8049539300.mkv?pos=1713411208661&duration=30
Now what I'm looking for is that through the js fetch api, I can download the video and send it through a form.
I tried to do it this way, but I get a cors error:
await fetch(
.../hls/8e381942-ee6a-b4e1-5108-6d8049539300.mkv?pos=1713411208661&duration=30
, { credentials: "include" });
0
-
Hi Franco,
This is expected behavior as you might not see the header for CORS.
Nx Witness provides the response header, so you can modify your JS according to this tutorial.
(https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch)Access-Control-Allow-Origin *
0
Please sign in to leave a comment.
Comments
1 comment