Plugin to record voice?

Hello, does this plugin still work? Running it on a new project, I get the following:

TypeError: ARecAndPlay.stopStream.stop is not a function
at Game_Message.clear (AudioRecordAndPlay.js:309)
at Window_Message.terminateMessage (rpg_windows.js:4355)
at Window_Message.updateInput (rpg_windows.js:4390)
at Window_Message.update (rpg_windows.js:4306)
at rpg_core.js:7035
at Array.forEach (<anonymous>)
at WindowLayer.update (rpg_core.js:7033)
at rpg_scenes.js:262
at Array.forEach (<anonymous>)
at Scene_Map.Scene_Base.updateChildren (rpg_scenes.js:260)
SceneManager.catchException @ rpg_managers.js:1949
Hello, does this plugin still work? Running it on a new project, I get the following:

TypeError: ARecAndPlay.stopStream.stop is not a function
at Game_Message.clear (AudioRecordAndPlay.js:309)
at Window_Message.terminateMessage (rpg_windows.js:4355)
at Window_Message.updateInput (rpg_windows.js:4390)
at Window_Message.update (rpg_windows.js:4306)
at rpg_core.js:7035
at Array.forEach (<anonymous>)
at WindowLayer.update (rpg_core.js:7033)
at rpg_scenes.js:262
at Array.forEach (<anonymous>)
at Scene_Map.Scene_Base.updateChildren (rpg_scenes.js:260)
SceneManager.catchException @ rpg_managers.js:1949
Well the following line assumes that ARecAndPlay.stopStream is of type MediaStreamTrack. But for some users it is of the type MediaStream which does not contain any method for stopping itself, but it contains a list of MediaStreamTracks it's holding which then can be stopped:
1648321126581.png


Just replace it with:

JavaScript:
let tracks = ARecAndPlay.stopStream instanceof MediaStreamTrack ?
    [ ARecAndPlay.stopStream ] :
    ARecAndPlay.stopStream.getTracks();
tracks.forEach( track => track.stop() );

and it should work 😉
If you also got the problem of the plugin saving to the wrong directory here is what you could change to fix it:

This is the place in the code you should change:
1648322373488.png



Replace (1) with var pathName = path.resolve( '.' ); // get the current directory
And (2) with pathName

(1) Here the code will directly output the correct path to the project currently running
(2) Since you're using path to determine the project direcory it is already normalized and doesn't need a separate normalization anymore. It will just waste CPU and would be a bad coding style 😉

EDIT: You should also replace the + character after (2) with an , ^^

Original thread: https://forums.rpgmakerweb.com/threads/plugin-to-record-voice.77683/