HTML - Play Audio File
How to play an audio file in HTML?
_______________ Similar TutorialsIs it possible to simply add the word "Play" to an html web page, which, when selected, would play an audio file stored in my web page directory? If possible, can you provide the code? i'm guessing the web visitor would simply need audio player software on his/her computer? Which is on most if not all computers today. Correct? thanks. Hi, I have an album which has 5 to 6 audio files(wma). I used checkboxes to list the audio files. I want to select one or more of the audio files by ticking in checkbox and play those selected using a button. How can I do that using html? I see that many music sites use this functionality, but not sure how to code this using html? Can someone help? Note: I have already hosted the audio files and have the web url for all the wma files. When I put in my code, it works just fine on my Mac in Safari or Firefox. However, when I test it on a PC in Explorer 7 or 8 it starts playing automatically. This is what my code looks like: Code: <audio controls="controls"> <source src="/media/GOAL.wav" type="audio/wav" autostart="false"/> <embed height="100px" width="200px" src="/media/GOAL.wav" /> </audio> The "autostart" code I put in apparently is wrong. Is there a way to fix this so it does not autostart in Explorer and any other browers? Thx. I'm having a really odd problem with the html audio player. It looks fine if I don't click the play button, but the moment I click the play button, it would disappear and reappear around 15-20 pixels lower. Here is my code for a simple audio player: HTML: Code: <div id="audioplayer"> <span class="eightonesmall" id="audiotext"> Background music control</span> <audio controls="controls"> <source src="music/liangzhuhualuowuhui.ogg" type="audio/ogg" /> <source src="music/liangzhuhualuowuhui.mp3" type="audio/mp3" /> </audio> </div> CSS: Code: body { margin: 0; padding: 0; width: 100%; height: 100%; overflow:hidden; background-image:url(../pictures/drawings/backgrounds/menubackgroundbubbles.png); background-position:center; background-attachment:fixed; } #audiotext { vertical-align:middle; color:#CCCCCC; } #audioplayer { position:fixed; top:10px; right:10px; border:3px double #FFF; height:30px; } The same problem occurs for an audio player that I've set to hidden, and will appear if I click an arrow and disappear if I click another arrow. It hides it and re-appears fine, just the player shifts down 15-20 pixels if I click play... HTML: Code: <div class="collapsearrow"> <img src="pictures/thumbnails/musicboxbuttons/collapsearrow.png" alt="collapsearrow" onclick="document.getElementById('song1').style.visibility='visible';"/>Liangzhu </div> <div id="song1" style="visibility:hidden;"> <img src="pictures/thumbnails/musicboxbuttons/contractarrow.png" alt="contractarrow" onclick="document.getElementById('song1').style.visibility='hidden';"/> <audio id="musicboxplayer" controls="controls"> <source src="music/liangzhuhualuowuhui.ogg" type="audio/ogg" /> <source src="music/liangzhuhualuowuhui.mp3" type="audio/mp3" /> </audio> </div> CSS: Code: #musicboxplayer { position:relative; width:86px; height:25px; } .collapsearrow { float:left; } #song1,#song2,#song3,#song4 { width:150px; float:left; } Does anyone know what's causing this? Thanks. I am designing a web page using Wordpress and have a rudimentary but working knowledge of HTML and have resources to help, so bear with me... My web site calls some audio files and they work fine. The line I am using is (a href=" url ") announcement (/a) Substitute appropriate GT & LT symbols accordingly... When I activate the page, the audio player covers the entire screen and all I get is a slide bar showing the progress of the audio track. Very boring,... What can I do to place an image there or change the size of the image to allow other image or words to be on the screen. I would appreciate it if I could get a sample of code to tweak. I used code below to paly mp3 file but none of them working. Why? < A HREF = "MYMP3.MP3".....> OR, <EMBED SRC= "MYMP3.MP3" ...> The audio files I use on my web page display the individual control (play stop pause buttons) windows on my monitor screen and all the music segments play when actuated. However some users report that they get a distorted page and nothing works. I am using XP and Vista with IE7. Can anyone help find the cause of the problem? http://www.lvrny.net/theme.htm I'm wondering if anyone knows if this is possible and if so how: I want to create a web page that will play a random audio file from a folder on my server. I'd like the user to hear the audio file and then try and identify it and be told whether they are correct or not and what the correct answer is. Can this be done with html or do I need to use flash? Any help would be greatly appreciated! Thanks. How to play sound file right away by clicking withoud download file first? http://americancreek.com/inmedia/treatycreek/ When you click on this link, the articulate file is supposed to start playing automatically, but it does not. If you click refresh, the file starts to play. Also, if you click "next" and then go back, it starts to play. It's only when you clear your cache and click the link again, is when it does not play and just sits there. Hi there in new here so please be nice haha ok i want a Mp3 file which is located in the same directory as my web page file to play in the background of my web page saved on my computer. i have tried loads of different codes, but to no success. I am using firefox browser 3.0.9 version. I created the html webpage using notepad. I have installed apple's quicktime as this website said so: http://kb.mozillazine.org/Background...doesn%27t_play Here is my code, please could somebody tell me where i am going wrong: Code: <html> <head> <title>My webpage!!!!!!!!!</title> </head> <body> <object data="music.mp3" type="application/x-mplayer2" width="0" height="0"> <param name="florida.mp3" value="music.mp3"> <param name="autostart" value="1"> <param name="playcount" value="true"> </object> </body> </html> Any help would be great many thanks and kind regards Jackie x Hi everyone. I am new to this forum and have very basic HTML knowledge. I've set up a page at http://www.freudiansliprecording.com/thelastsupper which, as it is coded now, automatically plays a goofy 5 second MP3 audio file when the page loads. What I would like to do is have the page randomly choose between 2 or three different of these very short MP3 audio clips and play one of them (and only one of them) when a visitor first comes to this page. Can anyone here recommend a way for me to do this? I do not want a visible player for this randomly chosen clip. Thank you all very, very much in advance for your help Cheers, Kevin This may be a relatively easy answer but here we go.... HTML Code: <a href="audio.wav">Play this wav file!</a> The above is just a simple example but my problem is that no matter what I keep getting prompted for a download... Is there any specific reason why IE7 cannot directly access wav files or is this issue due to security settings.... Normally, in the past I haven't had an issue but at this time I am at a loss.... Any help would be appreciated... Thanks, Dark_Jackal Hi everyone. I am working on a project with a few friends. The site is designed for people who are illiterate and so we are looking into how we could go about having audio cues play whenever the user hovers over a button or a section of an image map. If anyone would know of a good tutorial on how to do so in html5 it would be appreciated. Hello, I'm creating a site that requires the inbuilt audio player to keep streaming music between page loads. What coding options are available for this, HTML, PHP or otherwise? Regards Eddie I'm trying to playback an mp3 from within a table cell using a <a href> link. I don't want to use Flash and also don't want to use the HTML5 <audio> tag. I found this code Quote: function DHTMLSound(surl) { document.getElementById("dummyspan").innerHTML= "<embed src='"+surl+"' hidden=true autostart=true loop=false>"; } <span id=dummyspan></span> <form> <input type="button" value="Play Sound" onClick="DHTMLSound('success.wav')"> </form> and tried to incorporate it into the page. No luck. I think should be able to add the onClick part to the <a href> and have it play, but I get nothing. Thanks for any help, Mei I want to be able to add a mp3 audio file of a sermon to a church website I am building. I have done searches and find a lot of "embed" code, but none of these work. Nothing shows on the web page. What is the simplest way of doing this. I understand "embed" is not a legal word. I have tired "Object", but nothing shows using this command either. Any help will be appreciated. Lawrence Hey, On my site i have currently got windows media player to play an embedded wma file Code: <object id="MediaPlayer" height=46 classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"> <param name="filename" value="Windows XP Startup.wma"> <param name="Showcontrols" value="True"> <param name="autoStart" value="True"> <embed type="application/x-mplayer2" src="Windows XP Startup.wma" name="MediaPlayer"></embed> </object> That's my current source code for it ideally i would like to make it have the playlist option so on the playlist they can double click which songs they would like to listen Is this possible Cheers Lolium P.s, would it be possible for people who view the web page to browse the directory were the audio files will be kept? so they can choose which song to play?? I am attempting to link to audio files that exist on my server using the anchor tag. I am able to download and play the audio files just fine on Firefox, Chrome and Safari, but not on Internet Explorer. When I click the link in IE, all I see is a bunch of random characters. Also, when I attempt to download the audio file IE attempts to download it as an html file. What can I do to fix this so that I am able to access these files via IE. Here is the code. Code: <a href="/audioFile.aif">audioFile.aif</a><br /> I currently run a phpBB3 forum, and I have one topic in particular that I want audio to play in. I did some looking around and found some HTML that would allow me to play an audio clip. I went to that topic, opened the source, plugged in the HTML, and after uploading the audio file, I pressed the apply changes, and it worked. The thing is, how do I SAVE it to the site? *The actual code I entered has the correct domain name. Code: <EMBED src="http://www.mydomain.com/forum/folder/who.wav" autostart=true loop=false volume=100 hidden=true><NOEMBED><BGSOUND src="http://www.mydomain.com/forum/folder/who.wav"></NOEMBED> Another question, not sure if HTML, but the favicon.ico for the address bar/favorites that I set works for Opera, but not for IE8...any ideas? |