BalenaCam error 403 (Forbidden) when tried to embeded into another site

Hi Balena team,

I followed the instruction in Build a Raspberry Pi-based network camera using WebRTC and can get BalenaCam activated on my Raspberry Pi 3. I am able to see the streaming video from my pi via the public device url option.

I can view the mjpeg stream directly with this URL https://----BalenaPublicURL—/mjpeg. So, I would like to embeded mjpeg stream into my personal website, but it seems to be not possible. I received the below error.

GET https://----BalenaPublicURL—/mjpeg 403 (Forbidden)

Not sure if it would be possible to manage any permission to allow this mjpeg stream to be embeded as a video source into another website? Or I need to go for premium account?

video id=“cam_switch” src= “https://----BalenaPublicURL—/mjpeg” height=“600” width=“100%”/>

NOTE: I already tried iframe> and yes! it works. However, it’s impossible to fit the page in iframe to my static iframe size.

Please kindly advise. Thank you.

Best regards,
Leondevil.

Hi @leondevil,
Can you share a bit more from your code that you used to embed the mjpeg stream to your website?
BalenaCam internally uses a dynamically created <img /> tag and simply set it’s src property to the mjpeg url.
Let me point you to that part of the code:

A simple <img src="https://----BalenaPublicURL—/mjpeg" /> html tag should be enough though.

Since this is a forbidden error, are there any other warnings or error logs printed on your browser console?
Could this be a CORS or CSP related error?
I could take a closer look if you could share with us the url of the website that will host the mjpeg?

Kind regards,
Thodoris

Hi @thgreasi,

Thank you very much. It seems working with img tag. :slight_smile:

Best regards,
Leondevil.

I’m glad that it work for you.
Thanks for letting us know.

Kind regards,
Thodoris