Questions tagged [html5-audio]

The audio element is used to embed sound content in an HTML or XHTML document. The audio element was added as part of HTML5.

HTML5 defines a new element which specifies a standard way to embed an audio file on a web page: the <audio> element.

The control attribute adds audio controls, like play, pause, and volume.
You should also insert text content between the <audio> and </audio> tags for browsers that do not support the <audio> element.
The <audio> element allows multiple <source> elements. <source> elements can link to different audio files. The browser will use the first recognized format.

Read on at w3c HTML5 Audio. More information can also be found on Wikipedia.

Related Articles:

3529 questions
983
votes
22 answers

How to play audio?

I am making a game with HTML5 and JavaScript. How could I play game audio via JavaScript?
rshea0
  • 11,769
  • 9
  • 27
  • 40
331
votes
18 answers

Sound effects in JavaScript / HTML5

I'm using HTML5 to program games; the obstacle I've run into now is how to play sound effects. The specific requirements are few in number: Play and mix multiple sounds, Play the same sample multiple times, possibly overlapping playbacks, Interrupt…
Stéphan Kochen
  • 19,513
  • 9
  • 61
  • 50
218
votes
18 answers

HTML5 Audio stop function

I am playing a small audio clip on click of each link in my navigation HTML Code: JS…
Alok Jain
  • 3,379
  • 3
  • 23
  • 42
152
votes
8 answers

HTML5 record audio to file

What I ultimately want to do is record from the user's microphone, and upload the file to the server when they're done. So far, I've managed to make a stream to an element with the following code: var audio =…
Fibericon
  • 5,684
  • 12
  • 37
  • 64
139
votes
11 answers

How to play a notification sound on websites?

When a certain event occurs, I want my website to play a short notification sound to the user. The sound should not auto-start (instantly) when the website is opened. Instead, it should be played on demand via JavaScript (when that certain event…
Timo Ernst
  • 15,243
  • 23
  • 104
  • 165
138
votes
23 answers

How to make audio autoplay on chrome

Audio autoplay is working in Mozilla, Microsoft Edge and old Google Chrome as well but not in Google Chrome 67+ due to a policy change for autoplay. They have blocked the autoplay (until specific session conditions are met as specified in the linked…
Akshay Rathod
  • 1,593
  • 3
  • 10
  • 17
92
votes
9 answers

Why doesn't Firefox support the MP3 file format in

Is there a particular reason why Firefox does not support playback of MP3 files in
Mark
  • 39,169
  • 11
  • 42
  • 48
90
votes
10 answers

HTML5 Audio Looping

I've been playing with HTML5 audio recently, and though I can get it to play the sound it only ever will play once. No matter what I try (setting the properties, event handlers, etc) I can't seem to get it to loop. Here's the basic code I'm…
Toji
  • 33,927
  • 22
  • 105
  • 115
89
votes
10 answers

Setting HTML5 audio position

How to jump to certain time offsets in HTML5 Audio elements? They say you can simply set their currentTime property (emphasis mine): The currentTime attribute must, on getting, return the current playback position, expressed in seconds. On…
katspaugh
  • 17,449
  • 11
  • 66
  • 103
66
votes
7 answers

change

I have multiple audio files that I want to stream based on the user selects. How do I do that? This is what I have so far and it doesn't seem to work. *UPDATE: Made a few changes and now its claiming that audio.load(); is not a function. Can anyone…
Jmh2013
  • 2,625
  • 2
  • 26
  • 42
58
votes
2 answers

Streaming audio from a Node.js server to HTML5

I've been experimenting with binary streams in Node.js, and much to my amazement do actually have a working demo of taking a Shoutcast stream using node-radio-stream and pushing it into a HTML5 element using chunked encoding. But it only works in…
Scott Wilson
  • 1,650
  • 1
  • 17
  • 14
53
votes
4 answers

Web Audio API for live streaming?

We need to streaming live audio (from a medical device) to web browsers with no more than 3-5s of end-to-end delay (assume 200mS or less network latency). Today we use a browser plugin (NPAPI) for decoding, filtering (high, low, band), and playback…
Tony
  • 1,986
  • 2
  • 25
  • 36
47
votes
4 answers

How do I play audio files synchronously in JavaScript?

I am working on a program to convert text into morse code audio. Say I type in sos. My program will turn this into the array [1, 1, 1, 0, 2, 2, 2, 0, 1, 1, 1]. Where s = dot dot dot (or 1,1,1), and o = dash dash dash (or 2,2,2). This part is quite…
dactyrafficle
  • 838
  • 8
  • 18
44
votes
7 answers

Is it possible to check if the user has a camera and microphone and if the permissions have been granted with Javascript?

I would like to find out if the user's device has an attached camera and microphone, and if so, has permissions been granted to get the audio and video stream using Javascript. I want to make this check to be made across Chrome and Firefox at the…
Amal Antony
  • 6,477
  • 14
  • 53
  • 76
42
votes
4 answers

How do you check if a HTML5 audio element is loaded?

I am wanting to know how to check if a HTML5 audio element is loaded.
Aurange
  • 943
  • 2
  • 9
  • 23
1
2 3
99 100