If this is the code for video, what's the code for audio?

If this is the code for video, what’s the code for audio?

<video src="http://hi5.1980s.fm/;" width="50" height="50" style="cursor: pointer;background-color:orange;" onclick="this.paused?this.play():this.pause();"/>

<audio src="myfile.mp3"> </audio>

How come it’s not working?

<audio src="http://hi5.1980s.fm/;" width="50" height="50" style="cursor: pointer;background-color:orange;" onclick="this.paused?this.play():this.pause();"></audio>

All it is is html5 audio instead of video, the same code functions should work, but they don’t. How come?

You have to link to an actual audio file, and one that’s supported. E.g.

<audio src="http://tekstopia.uio.no/flannor/wp-content/uploads/What-is-happening-here_-2.mp3"></audio>

That’s not working either.

It works if you add controls so you can actually play it.

<audio src="http://tekstopia.uio.no/flannor/wp-content/uploads/What-is-happening-here_-2.mp3" controls></audio>

There is a good, clear guide here: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_HTML5_audio_and_video

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.