Display MJPEG stream in iframe with Reverse Proxy for auth - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Display MJPEG stream in iframe with Reverse Proxy for auth (/showthread.php?tid=4890) |
Display MJPEG stream in iframe with Reverse Proxy for auth - Diggerz - 26.07.2023 Hi, Im using the followig code to create a reverse proxy to authenticate with a Camera NVR and attempt to display the MJPEG stream in an iframe. This is to display the nvr camera feed in the visu without the user needing to fill the auth each time. Currently i can display a snapshot ( the /path 6 url ) but i would like display the MJPEG stream ( the /path5 url ). The MJPEG stream works in the iframe without the proxy if i set the src as the nvr url directly and manually fill the auth form when it pops up. The Auth is successfully prefilled using the proxy when displaying the snapshot but i have only been successful in display a snapshot and not the MJPEG stream url. Also open to any alterations as im unsure if the current method will drain memory with the proxy handling the MJPEG stream. current code below: Code: if not server then RE: Display MJPEG stream in iframe with Reverse Proxy for auth - admin - 26.07.2023 MJPEG is an endless stream so it won't work the same way as snapshot (request -> response). Proxying a video stream is too demanding on the CPU anyway. It's recommended to use a different device like RPi for this. RE: Display MJPEG stream in iframe with Reverse Proxy for auth - Diggerz - 26.07.2023 Is there any other approach that can be used to complete the Auth? I can simply put the MJPEG video stream url in the iframe but then the user needs to enter the auth each time which is a nuisance. RE: Display MJPEG stream in iframe with Reverse Proxy for auth - Daniel - 26.07.2023 You can stay with snapshot and keep refreshing frame. Not fully live stream but should work. RE: Display MJPEG stream in iframe with Reverse Proxy for auth - Diggerz - 26.07.2023 Thanks, I’ll work with this for now and see how it goes RE: Display MJPEG stream in iframe with Reverse Proxy for auth - Joep - 28.07.2023 (26.07.2023, 09:14)Diggerz Wrote: Thanks, I’ll work with this for now and see how it goes What happens if you use the basic auth also in the url like: https://user:password@<NVR IP>/cgi-bin/mjpg/video.cgi?channel=3&subtype=1 RE: Display MJPEG stream in iframe with Reverse Proxy for auth - Diggerz - 29.07.2023 Passing the credentials in the url like that does not work due to security updates in firmwares and also browser security. Is it possible to use JavaScript to fill the auth form with event listeners on the iframe? Or is this simply not possible. I’m having trouble with the proxy and the iframe refresh times, the images stall or go blank upon some refresh’s. RE: Display MJPEG stream in iframe with Reverse Proxy for auth - Diggerz - 02.08.2023 I haven’t had a lot of success getting the MJPEG stream to work with auto auth. I think I’ll try the rpi rout. Before I make a start does anyone have any suggestions or something already created? RE: Display MJPEG stream in iframe with Reverse Proxy for auth - admin - 02.08.2023 Try one of these: https://github.com/legege/node-mjpeg-proxy https://github.com/vvidic/mjpeg-proxy RE: Display MJPEG stream in iframe with Reverse Proxy for auth - Diggerz - 06.08.2023 Thanks for the pointers and the recomendation on the RPi. I've set up a proxy using express on the pi and it handles the auth. I can now stream the NVR camera MJPEG urls in an iframe without the auth poping up each time. |