Discussion Forums  >  WebViews and HTML for Mobile

Replies: 12    Views: 86

Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
11/28/12 07:05 AM (11 years ago)

how do i reference audio file from html

Im at work just now but will try when i get home if i don't get any answer here. I have an app (android) that plays audio from dropbox link in html doc. My question is if i add the audio files direct to bt docs audio folder how do I reference it to be used from html screen. Is it just src="filename.mp3"
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
11/28/12 08:16 AM (11 years ago)
HI Mr stuck. Yes if you have your mp3 files in your docs older. You can not have a under folder in docs folder if it is Android. Xcode put it where ever you want. Look here. http://www.w3schools.com/html/html_sounds.asp
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
11/28/12 08:26 AM (11 years ago)
Thanks. So i add the files to the bt docs folder but not in the audio folder. Cool.
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
11/28/12 08:32 AM (11 years ago)
@Mr stuck, When I downloaded the quiz from here, I put the sound in audio..not sure if it's the same thing with html. I believe in html, it depends on the audio player your using. LA
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
11/28/12 09:35 AM (11 years ago)
@LA I am using the html audio tag. Just thought it would be better if the audio was in the app to save users data plan. Will try a few things out when i get time but the app works ok streaming it. Thanks
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
11/28/12 09:48 AM (11 years ago)
You should be able to put it right in your app, unless your using html for another reason. LA
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
11/28/12 02:56 PM (11 years ago)
Good topic!
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
11/29/12 01:11 AM (11 years ago)
@LA I tried and failed to set audio as background music as it seems it only works for ios so the only way i could achieve audio was via the html5 audio tag. After using this tag the audio continued to play even after exiting the screen or app but i managed to find the piece of code to resolve that so all works fine now, I have hidden the audio controls also as they were causing a weird problem with track resuming after watching YouTube. It appears the paused audio was held in the background and started again after using YouTube. I just am not comfortable with end users having to eat up their data to listen to the same tracks so thought it may be better to include the mp3 files directly in the app. I could not find any other method to get audio to play in android app but open to any suggestions. Thanks again
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
11/29/12 07:22 AM (11 years ago)
@Mr stuck, I am sure you already looked at this but going to give you the link anyway: http://developer.android.com/training/managing-audio/audio-focus.html I believe your problem is within the KeyEvent, Audio focus...and with your android controls. Mp3 is not the most stable format anymore. You using a playlist? LA
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
11/29/12 07:39 AM (11 years ago)
One more point, how you call your Audio Focus in your steps of Start, pause, and kill the app process will determine the order so I would suggest calling the audio focus way early in your steps of an app cycle before the playback. Does this make sense? LA
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
11/29/12 02:25 PM (11 years ago)
Thanks LA. Im not using java to play the audio as i can t code but the audio tag html is simple enough to implement. I am using a menu with image to display list of tracks which when selected launch a custom url screen to a html doc on drop box which plays audio. Perhaps if i send you send you the apk you will get a better idea just send me your email. But it is just a very simple app although i have some ideas for expanding it in future. Thanks again
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
11/29/12 02:31 PM (11 years ago)
Sure no problem..it's [email protected] LA
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
11/29/12 03:06 PM (11 years ago)
Cool. Apk sent. Thanks
 

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.