Fix "TypeError: recBuffers.push is undefined"#37
Open
MotasemAghbar wants to merge 1 commit intohiguma:masterfrom
Open
Fix "TypeError: recBuffers.push is undefined"#37MotasemAghbar wants to merge 1 commit intohiguma:masterfrom
MotasemAghbar wants to merge 1 commit intohiguma:masterfrom
Conversation
|
Thanks for this PR, it works perfectly. Too bad the original developer has vanished and this won't be ever merged. |
|
I think that a better fix for this issue is to remove onaudioprocess event handler before processor has been deleted in cancelRecording function and finishRecording function (WevAudioRecorder.js): cancelRecording: function () {
if (this.isRecording()) {
this.input.disconnect();
this.processor.disconnect();
this.processor.onaudioprocess = null;
delete this.processor;
this.worker.postMessage({ command: 'cancel' });
} else this.error('cancelRecording: no recording is running');
},
finishRecording: function () {
if (this.isRecording()) {
this.input.disconnect();
this.processor.disconnect();
this.processor.onaudioprocess = null;
delete this.processor;
this.worker.postMessage({ command: 'finish' });
} else this.error('finishRecording: no recording is running');
}, |
|
@maria-nedelkova thank you for the fix, I add the line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The function 'record' might throw a TypeError when executing
recBuffers.push.This happens when stopping the recorder, there is a chance for a race condition in the last 'record' event call and clean method, the clean method assigns the recBuffers to null, record event might be executing after the clean method, and then throw type error because recBuffers isn't defined.
The fix is to check if the recBuffers is undefined before accessing that var.