Discussion Forums  >  Uncategorized

Replies: 5    Views: 214

koopakid08
Aspiring developer
Profile
Posts: 74
Reg: Jun 14, 2011
earth
1,540
12/24/11 02:48 PM (14 years ago)

Play audio using custom HTML? ANDROID

Hello, I am thinking about making an app that requires audio to play when you tap on a image. I was wondering if anyone here knows if Android supports the <audio> tag in HTML5 or do I have to use the <video> tag?? Also if it does support it where in my app would I place the audio file? I am new to this whole HTML5 thing and my web development skill are a little rusty. Thanks in advace!
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
12/24/11 04:26 PM (14 years ago)
You can test the tags to see if they work and get back to us :) You could try and put the files on a third party site if you want, rather then buzztouch, but you can place it in the BT_Sound folder otherwise.
 
MacApple
Apple Fan
Profile
Posts: 4675
Reg: Oct 25, 2010
USA
61,150
like
12/24/11 05:00 PM (14 years ago)
If you are tapping a button within the app it is very easily done. The BT code will preload any mp3 files you add to it, all you have to do is add them to the appDelegate.m file in Eclipse. Look for this code: //load sound effects -(void)loadSoundEffects{ //this runs in it's own thread NSAutoreleasePool *pool = [ [ NSAutoreleasePool alloc ] init ]; [BT_debugger showIt:self:[NSString stringWithFormat:@loadSoundEffects %@, @]]; //fill an array of sound effect file names self.soundEffectNames = [[NSMutableArray alloc] init]; [self.soundEffectNames addObject:@saywhat.mp3]; [self.soundEffectNames addObject:@nice.mp3]; Add your mp3 file references in a list and they will be good to go. Remember though, audio clips for button presses or quiz answers should be around 3 seconds max or you'll experience some performance degradation. Are you looking at playing sound effects or streaming longer music?
 
koopakid08
Aspiring developer
Profile
Posts: 74
Reg: Jun 14, 2011
earth
1,540
like
12/24/11 05:51 PM (14 years ago)
What I am looking to do is to get an audio file to play when an image is touched and the loop the 2 minute track until it is touched again. I would also like to be able to have everything be avalible offline.
 
MacApple
Apple Fan
Profile
Posts: 4675
Reg: Oct 25, 2010
USA
61,150
like
12/24/11 06:30 PM (14 years ago)
Very doable. MP3 will be added to app so is available online. Large mp3 files are going to add I app size though and remember many will download on 3G. I wouldn't place the sounds on a third party site, no way they will play as you touch the button. Try exporting in the audio in lowest bitrate you can without losing quality. Anyway, few tutorials on here showing how to do what you are tying. Have a wee search and if you can't find it post back and I'll try and dig it out. you'll have to change a few lines of code but you'll be good.
 
Rad Doc
Apple Fan
Profile
Posts: 653
Reg: Oct 08, 2010
USA, NYC
8,580
like
12/26/11 05:46 AM (14 years ago)
Guys, although audio is not yet available for android 1.5 or 2.0, has anyone figured out a work around to get music to stream for android? I've added .mp3 files to my server and tried to fetch and play them through a custom URL link and it does not work. Any suggestions on how to get my project going. This is my big holdup to releasing My app for android.
 

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.