So I'm pretty convinced this is a bug at this point, having checked, rechecked, and rewritten, this script in addition to reformatting and reloading the audio files. For some reason I have no problems with audio playback in the browser but when I test it on mobile (iPhone 7plus and Android), the audio doesn't seem to load.
Here's the code. If anyone can provide some insight as to the issue I'm at my wit's end with this one,lol:
var kick;
var snare;
var kickisPlaying = false;
var snareisPlaying = false;
var cHatisPlaying = false;
var oHatisPlaying = false;
var booleanToggle;
booleanToggle = false;
var debug;
debug = Scene.getItem("TswbK8TCr1");
var playButton;
var plyBut2;
var toggleBut;
var hatButt1;
playButton = Scene.getItem("587H69jNH5");
plyBut2 = Scene.getItem("NGuGwBdkoI");
hatButt1 = Scene.getItem("HH3RfUcgsx");
toggleBut = Scene.getItem("ZtMFaCSu0q");
let currentTime = Scene.currentTime();
let soundClipId = 'Xtt6BJaiAuuAsOBXoG2CwhPYAhrgbtOj6ZfMbr6QSYH'
let soundClipId2 ='XTOUJIJRI63RdotSaRiU5ieLpHxvo94upRV4ytxfxKK'
let soundClipId3 = 'fkYF1AIgH0LeRnEGQnK6xST5DuGInYghCtO8Cr7UUNv'
let startTime = currentTime + 0.100;
let BPM = 190;
let quarterTime = (60/BPM);
let eighthTime = (quarterTime/2);
let sixteenthTime = (eighthTime/2);
//Kick Loop
function fourOnTheFloor(){
kickisPlaying = true;
Scene.loadSound(soundClipId, function(kick) {
debug.say('start'+ startTime)
let kickLoop = Scene.scheduleRepeating(function() {
// Play the kick drum on beats 1, 2, 3, 4
Scene.schedule(
kick.play, startTime + quarterTime);
Scene.schedule(
kick.play, startTime+ 2*quarterTime);
Scene.schedule(
kick.play, startTime+ 3*quarterTime);
if(!kickisPlaying){kickLoop.dispose();}
}, 4*quarterTime);
})};
//Snare Loop
function straightSnare(){
snareisPlaying = true;
Scene.loadSound(soundClipId2, function(snare) {
debug.say('start'+ startTime);
let snareLoop = Scene.scheduleRepeating(function() {
// Play the snare drum on beats 2, 4
Scene.schedule(
snare.play, startTime + quarterTime);
Scene.schedule(
snare.play, startTime+ 3*quarterTime);
if(!snareisPlaying){snareLoop.dispose();}
}, 4*quarterTime);
})};
//ccHat Loop
function cHat(){
cHatisPlaying = true;
Scene.loadSound(soundClipId3, function(cHat) {
debug.say('start'+ startTime)
let cHatLoop = Scene.scheduleRepeating(function() {
// Play the snare drum on beats 2, 4
Scene.schedule(cHat.play, startTime + eighthTime);
Scene.schedule(cHat.play, startTime+ 2*eighthTime);
Scene.schedule(cHat.play, startTime+ 3*eighthTime);
Scene.schedule(cHat.play, startTime+ 4*eighthTime);
Scene.schedule(cHat.play, startTime+ 5*eighthTime);
Scene.schedule(cHat.play, startTime+ 6*eighthTime);
Scene.schedule(cHat.play, startTime+ 7*eighthTime);
if(!cHatisPlaying){cHatLoop.dispose();}
}, 8*eighthTime);
})};
//Loop Button
toggleBut.onActivate(function()
{
debug.say('Pressed')
if(!booleanToggle){toggleBut.setColor(5,255,5);
booleanToggle = true;
fourOnTheFloor()
straightSnare()
cHat()
}
else if(booleanToggle){toggleBut.setColor(255,5,5);
booleanToggle = false;
var kickisPlaying = false;
var snareisPlaying = false;
var cHatisPlaying = false;
var oHatisPlaying = false;
}
});
//Kick Start
playButton.onActivate(function()
{
debug.say('Pressed')
if (!kickisPlaying){
fourOnTheFloor()
}
else if(kickisPlaying){kickisPlaying = false;}
});
//Snare Start
plyBut2.onActivate(function()
{
debug.say('Pressed')
if (!snareisPlaying){
straightSnare()
}
else if(snareisPlaying){snareisPlaying = false;}
});
//cHat Start
hatButt1.onActivate(function()
{
debug.say('Pressed')
if (!cHatisPlaying){
cHat()
}
else if(cHatisPlaying){cHatisPlaying = false;}
});