Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using API to stop recording after page reload #84

Open
thebordella opened this issue Sep 20, 2019 · 3 comments
Open

Using API to stop recording after page reload #84

thebordella opened this issue Sep 20, 2019 · 3 comments

Comments

@thebordella
Copy link

thebordella commented Sep 20, 2019

I am using RecordRTC_Extension() API to control recording using HTML elements on web page. E.g.

var recorder = new RecordRTC_Extension();
document.getElementById('btn-start-recording').onclick = function() { 
   recorder.startRecording({
   enableTabCaptureAPI: true,
   }); 
});
document.getElementById('btn-stop-recording').onclick = function() { 
   recorder.stopRecording(function(blob){ 
     //do something with blob
   });
});

Works good!

But, suppose user action causes page to reload due to design of web app. After page reloads, the above code runs again, but recorder.stopRecording() does not stop the extension from recording. Instead, recording just continues.

I guess that new instance of var recorder = new RecordRTC_Extension() is somehow the problem? How to re-connect to extension to trigger stop?

@muaz-khan
Copy link
Owner

You can fire stopRecording inside onbeforeunload event. E.g.

window.onbeforeunload = function() {
    recorder.stopRecording();
};

@thebordella
Copy link
Author

Yes, that will work to stop recording before page reloads. But I want recording to continue while page reloads, and only stop when user clicks my stop button. But after page reload, my stop button does not work because "var recorder = new RecordRTC_Extension()" does not connect to same "instance" of extension. Maybe I am missing something?

@muaz-khan
Copy link
Owner

That feature isn't implemented at the moment. I'll let you know when its available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants