I'm recording my screen on a webpage with navigator.mediaDevices.getDisplayMedia
. But when I reload the page, it stops. I'd like to automatically continue recording. Is it possible?
Maybe I could use the localstorage somehow, that the reloaded page would try to record again, but then the prompt to choose the screen to record appears again, but I'd like to have picked the same screen to record automatically as before, so that the users aren't bothered after every page reload.
Is there any way, maybe service workers could be the way? Thanks.
A MediaStream is tied to its realm's responsible document. When this document's permission policy changes or if the document dies (unload), the MediaStream's captured tracks will end.
The only way around for your case, would be to start the recording from an other document (popup/tab) that your users would have to keep open the whole time.
Here is a plnkr demonstrating this, but that may be quite complex for your users to deal with...
In the page to record:
and in the popup page