stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
02/04/17 06:29 PM (7 years ago)

Audio not playing

I have a home screen that is a simple menu. I have chosen an mp3 file as background audio and indeed it is in the BT_audio folder in Xcode. I can even play it from there. But when I run the app on the simulator, no sound. Any ideas? Thanks
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
02/05/17 10:22 AM (7 years ago)
I don't trust the simulator. Have you tried on a physical device?
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
02/05/17 11:38 AM (7 years ago)
Yes. No dice. I have the mp3 file in both bt_audio and in bt_docs but no good.
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
02/05/17 01:50 PM (7 years ago)
The only way I seem to be able to get it to play is to add some html code. However this won't autoplay and many an internet post seems to confirm that Apple won't allow autoplay. I guess I can live with this, but the play icon for the audio file is partially hidden under the nav bar on smaller devices. Any way to get the play icon to be a little further down. The html code is : <audio autoplay="autoplay" controls="controls" loop="loop" preload="auto" tabindex="0"> <source src="chopin.mp3" type="audio/mpeg"> </source></audio>
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
02/10/17 01:17 AM (7 years ago)
can you not just add some <P></P> before your code?
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
02/10/17 06:33 AM (7 years ago)
That seems like a good idea. I'll try it when I get home from work but I'd still like to know why the simple menu audio item doesn't do what it seems to be intended to do.
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
02/10/17 01:20 PM (7 years ago)
Actually, added the <p></p>'s but the audio play button remains in an unchanged position. Put the code right before the code I referenced above. Strange.
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
02/10/17 07:57 PM (7 years ago)
Actually you need to put something between the opening and closing tags. Spaces are not sufficient. So I put in a few --- and that works. Still would rather use the simple menu without having to put in html so if anyone could figure out why that's not working I'd appreciate it.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.