Pls fix a bug in the Discord voice messaging plugin.
Error: Failed to start MediaRecorder: Failed to execute 'getUserMedia' on "MediaDevices": getUserMedia is not supported.
Original: https://github.com/MKSx/Send-Audio-Plugin-BetterDiscord Error on line 1026.
Code with problem:
changeMedia(device=false, changing=false){
const plugin = this;
const change = () => {
plugin.media = null;
plugin.mediaInfo.ready = false;
plugin.mediaInfo.error = false;
navigator.mediaDevices.getUserMedia({audio: (device != false ? device : plugin.settings.devices)}).then(s => {
plugin.media = new MediaRecorder(s);
Logger.log("MediaRecorder started successfully");
plugin.media.addEventListener('dataavailable', e => plugin.onRecordingData(e.data));
plugin.media.addEventListener('start', _ => plugin.onRecordingStateChange(0));
plugin.media.addEventListener('stop', _ => plugin.onRecordingStateChange(1));
plugin.media.addEventListener('pause', _ => plugin.onRecordingStateChange(2));
plugin.media.addEventListener('resume', _ => plugin.onRecordingStateChange(3));
plugin.media.addEventListener('error', error => {
Logger.error('Recording error:', error);
});
plugin.mediaInfo.ready = true;
plugin.mediaInfo.error = false;
if(typeof plugin.buttons == 'object' && plugin.buttons.record instanceof Element)
plugin.buttons.record.disabled = false;
}).catch(err => {
plugin.mediaInfo.ready = false;
plugin.mediaInfo.error = true;
if(typeof plugin.buttons == 'object' &&plugin.buttons.record instanceof Element)
plugin.buttons.record.disabled = true;
Logger.error("Failed to start MediaRecorder:", err.message);
if(!changing){
Logger.log("Changing to the default");
plugin.changeMedia('default', true);
}
});
};
if(this.media instanceof MediaRecorder){
this.mediaInfo.notSave = true;
if(this.media.state != 'inactive')
this.media.stop().then(_ => change()).catch(_ => change());
}
else{
change();
}
}
from Discord voice messaging plugin: getUserMedia() is not supported
No comments:
Post a Comment