I have read a lot of posts on playing audio clips on mobile in the forum, and have made many attempts to use the info, but cannot get it right
I have imported two clips as controls, and they work in the IDE. I have checked to see that the clips are present (see commented out script lines), and am sure my sound is not muted on my iPhone.
I am including the openCard script, and the playSounds script. The commented out variable names after some of the lines are to show how I've attempted various forms of the audio clip/files.
I'm hoping someone can tell me what I'm doing wrong...
Many thanks!
Robert Mills
Code: Select all
on openCard
--if exists(audioClip "splash.aiff") then play "splash.aiff"
--if exists(audioClip "splash.aiff") then answer "theSplash exists!" with tFile
--if exists(audioClip "hit.aiff") then answer "aHit exists!" with tFile
if the environment is "mobile"
then
put "file:/" & specialfolderpath("engine") into sFolder
get "/splash.aiff"
put (sFolder & it) into tFile
put tFile into theSplashFile
put URL tFile into theSplash
get "/hit.aiff"
put (sFolder & it) into tFile
put tFile into aHitFile
put URL tFile into aHit
end if
end openCard
on playSounds soundNum
if not soundOn then exit playSounds
if the environment is "mobile"
then
-- first option
try
if soundNum = 1
then play "splash.aiff" -- theSplash
else play "hit.aiff" -- aHit
catch e
answer e
end try
-- second option
if soundNum = 1
then get theSplashFile -- theSplash
else get aHitFile -- aHit
try
if the environment is "mobile"
then mobilePlaySoundOnChannel it,"current", "now"
catch e
answer e
end try
else -- environment not "mobile"
if soundNum = 1
then play audioClip "splash.aiff"
else play audioClip "hit.aiff"
end if
end playSounds