I have a application where I am doing recording through a third party device using it’s API on my page. Recording is started and stopped through a asp.net web service..
I am able to start and stop the recording through JavaScript in normal cases and the functionality works fine in all browsers.
But, once accidentally one user without stopping the video, closed the browser in which case the recording could not be stopped.. and it went on recording..
So, please suggest me a way so that I can pass a request to the server to stop the recording automatically when the browser is closed..
Advertisement
Answer
You can’t.
You can show a standard dialog or do a few fast not interactive operations like writing in localStorage, by using onBeforeUnload, but you can’t make a request (in most browsers).
You have to handle the case of browser closing (or network lost, or any incident) server side.