This commit is contained in:
Mirco Wittrien 2020-11-22 15:12:40 +01:00
parent 806c10a6fb
commit 62db6fbb46
2 changed files with 43 additions and 47 deletions

View File

@ -465,7 +465,7 @@ module.exports = (_ => {
});
else BDFDB.LibraryRequires.fs.readFile(source, (error, response) => {
if (error) BDFDB.NotificationUtils.toast("Could not fetch file, please make sure the file exists", {type: "danger"});
else successSavedAudio(key, source, `data: audio/mpeg;base64,${response.toString("base64")}`);
else successSavedAudio(key, source, `data:audio/mpeg;base64,${response.toString("base64")}`);
});
},
children: BDFDB.LanguageUtils.LanguageStrings.SAVE

View File

@ -14,16 +14,12 @@ module.exports = (_ => {
"info": {
"name": "NotificationSounds",
"author": "DevilBro",
"version": "3.5.5",
"version": "3.5.6",
"description": "Allow you to replace the native sounds of Discord with your own"
},
"changeLog": {
"added": {
"Halloween": "Added discord's halloween call sound to the choices",
"Global Volume": "Added global volume slider affecting all sounds"
},
"fixed": {
"Removed Default Category": "Removed the category 'Default' since the audio files no longer exist on the webpage"
"Local Sounds not playing": "Fixed issue with newly added local sounds not playing"
}
}
};
@ -164,7 +160,7 @@ module.exports = (_ => {
_ensureAudio () {
return this._audio = this._audio || new Promise((callback, errorCallback) => {
let audio = new Audio;
audio.src = this._src;
audio.src = this._src && this._src.startsWith("data") ? this._src.replace(/ /g, "") : this._src;
audio.onloadeddata = _ => {
audio.volume = Math.min((BDFDB.LibraryModules.MediaDeviceUtils.getOutputVolume() / 100) * (this._volume / 100) * (volumes.globalVolume / 100), 1);
BDFDB.LibraryModules.PlatformUtils.embedded && audio.setSinkId(currentDevice || defaultDevice);
@ -506,7 +502,7 @@ module.exports = (_ => {
});
else BDFDB.LibraryRequires.fs.readFile(source, (error, response) => {
if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists", {type: "danger"});
else return successSavedAudio({category, sound, source: `data: audio/mpeg;base64,${response.toString("base64")}`});
else return successSavedAudio({category, sound, source: `data:audio/mpeg;base64,${response.toString("base64")}`});
});
},
children: BDFDB.LanguageUtils.LanguageStrings.SAVE