You may be attempting to commence a new recording while a current recording is ongoing. Ongoing recordings need to be stopped before you can start a new one.

Please note that if there are no connected peers, when the user refreshes the browser, the room will be considered to be closed and the recording will stop automatically.

However, if there are still peers present in the room when the user refreshes the browser, you need to call stopRecording before leaving the room.

You may wish to consider using a Window Event Handler like onunload to call stopRecording on browser refresh.

For Example:

window.onunload = function() {
    console.log('Stop Recording on browser referesh');