Help - Search - Members - Calendar
Full Version: The html audio doesn't work on cellphone
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Alexf
Hello. I have this html here to put audio on my website:

audio controls="">
<source src="put the link here" type="audio/mpeg"></source>
O player de áudio não funciona neste navegador. Experimente abrir em outro...</audio><br /></div>

It works perfectly on the computer, I can click and restart the audio, but when I try to hear the audio on my cellphone it just let me hear one time, I can't restart it.

My question is: How can I fix this problem to hear how many times I want on the cellphone?
miles_muso
Hi,

I'm no expert, in fact I posted a question on here about 4 hours ago, but I was looking at HTML audio and MAYBE this is your solution:

Some browsers, such as the one on your phone, don't like certain audio formats. I've read that you should give as many audio options as possible, so the browser can choose its preferred format.

The code is this:

CODE
<audio controls="controls">
    <source src="media/birds.mp3" type="audio/mpeg">
    <source src="media/birds.ogg" type="audio/ogg">
    <source src="media/birds.wav" type="audio/wav">
    Your browser does not support the HTML5 Audio element.
</audio>


I think setting audio controls = "controls" means that a control bar will appear, which has play/stop/pause controls embedded.

You'll need to duplicate your audio files in each format, and make sure they're all in the same folder on your server.

As I said, I'm a newbie, and so I might have got this completely wrong. But there's no harm in trying!!

There's also the option to set it as audio controls = "loop", which means the audio will loop automatically, which might be useful to you.

I found all this at https://www.bitdegree.org/learn/html-audio-tag

Hope it helps!


This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.