Fixed idiocy not working when sound isn't initialised.
This commit is contained in:
parent
017b720f8d
commit
1e439b87c0
1 changed files with 7 additions and 2 deletions
|
@ -20,8 +20,13 @@ const MamiYouAreAnIdiot = function() {
|
|||
const pub = {
|
||||
getElement: () => html,
|
||||
onViewPush: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise(resolve => {
|
||||
const soundMgr = mami.getSound();
|
||||
if(soundMgr === undefined || soundMgr === null) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
const soundSrcs = mami.getSoundLibrary().getSound('misc:youare').getSources();
|
||||
soundMgr.load('youarebgm', soundSrcs, (success, buffer) => {
|
||||
if(success) {
|
||||
|
@ -32,7 +37,7 @@ const MamiYouAreAnIdiot = function() {
|
|||
soundSrc.setLoop();
|
||||
soundSrc.play();
|
||||
resolve();
|
||||
} else reject();
|
||||
} else resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue