Discussion Forums  >  Suggestions, Ideas, Wish List

Replies: 10    Views: 259

RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
01/02/13 08:23 AM (13 years ago)

Play Sound Button inside HTML screen

Hi, Happy New Year, first of all ;) I'm a complete newby at this, but full of enthusiasm and drive to turn my idea into an app. I'm creating for Android, with Eclipse. So, I am playing around with "my First App" just to get comfortable with BT, Eclipse and ADT. Also, of course, to find out what's already available and what functionalities I might need for my app aren't yet. Now, here's my first question on this forum: I would like to add a little "play sound" button to a Custom HTML screen that actually plays sound when tapped. Is there a way to do this? I don't want it streaming since it needs to be played offline as well. Hope anyone can enlighten me. Thx in advance!
 
AppGuy30
Code is Art
Profile
Posts: 737
Reg: Oct 29, 2011
location unknow...
14,070
like
01/02/13 08:59 AM (13 years ago)
Welcome to buzztouch. I would try these codes, and place them in the source part of your html screen. <audio controls height="100" width="100"> <source src="horse.mp3" type="audio/mpeg"> <source src="horse.ogg" type="audio/ogg"> <embed height="50" width="100" src="horse.mp3"> </audio> or <embed height="50" width="100" src="horse.mp3"> and also where src=" " you can put a link to an mp3 file. Jack
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/02/13 09:44 AM (13 years ago)
Hey Jack, Thx for your swift reply! Much appreciated. In line with your explanation I placed the following in my html screen (in code mode: <audio controls height="100" width="100"> <source src="http://soundjax.com/reddo/86435%5ETrumpet2.mp3" type="audio/mpeg"> <source src="http://soundjax.com/reddo/86435%5ETrumpet2.ogg" type="audio/ogg"> <embed height="50" width="100" src="http://soundjax.com/reddo/86435%5ETrumpet2.mp3"> </audio> (The .ogg file doesn't really exist but I thought that would matter since I'm using Nexus 1 emulator.) But, nothing showed up on the specific screen in my app when I ran it. Am I stupid thinking a "play sound" button would magically appear on my screen? Or did I do something wrong? Thx again. Robin
 
AppGuy30
Code is Art
Profile
Posts: 737
Reg: Oct 29, 2011
location unknow...
14,070
like
01/02/13 09:51 AM (13 years ago)
Hmm thats weird, try pasting this one. <audio controls height="100" width="100"> <source src="http://soundjax.com/reddo/86435%5ETrumpet2.mp3" type="audio/mpeg"> <embed height="50" width="100" src="http://soundjax.com/reddo/86435%5ETrumpet2.mp3"> </audio> it already has your url in it.
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/02/13 10:02 AM (13 years ago)
Thx again (you're fast!). I tried it, but nope. It shows up in no-code mode but not in my emulator. Could it be Nexus 1 (google 2.2 API 8) doesn't support this? That's the emulator I'm running it in. I think not, but then again, I don't know much about all this yet. So help would again be appreciated ;) Robin
 
AppGuy30
Code is Art
Profile
Posts: 737
Reg: Oct 29, 2011
location unknow...
14,070
like
01/02/13 10:07 AM (13 years ago)
Then it must have something to do with the emulator. I would try running this on an actual device to see if this works, i would recommend a device that is running android 4.0 or higher.
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/02/13 10:07 AM (13 years ago)
Cheers. I will do that. Tomorrow. I'll let you know. Robin
 
AppGuy30
Code is Art
Profile
Posts: 737
Reg: Oct 29, 2011
location unknow...
14,070
like
01/02/13 10:41 AM (13 years ago)
Great! Best of luck.
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/04/13 03:35 PM (13 years ago)
Hey Jack, I downloaded the apk on my own Galaxy and it worked like a charm. Thanks for the advice. Strange that the emulator doesn't display it correctly... Should I mention that somewhere so it can be fixed? Regards, Robin
 
AppGuy30
Code is Art
Profile
Posts: 737
Reg: Oct 29, 2011
location unknow...
14,070
like
01/04/13 03:46 PM (13 years ago)
I don't think so, but I'm glad its working! Jack
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/04/13 03:56 PM (13 years ago)
All ready to really start working on my first project ;)
 

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.