JavaScript How to chain playing of several HTML5 audio files like a smooth playlist?

Given access to valid audio files :

<audio src="https://upload.wikimedia.org/wikipedia/commons/9/9b/Zh-Tianjin.ogg"></audio>
<audio src="https://upload.wikimedia.org/wikipedia/commons/8/8a/Zh-Beijing.ogg"></audio>
<audio src="https://upload.wikimedia.org/wikipedia/commons/7/73/Zh-Shanghai.ogg"></audio>
<audio src="https://upload.wikimedia.org/wikipedia/commons/e/e2/Zh-Chengdu.ogg"></audio>

Given a button :

<button id="play">Play me!</button>

Given I successfully play one audio

$('#play').on('click', function () {
    $("audio")[0].play();
});

How to chain the playing of these several audio, one after an other ? -- pure JS and JQuery, other JS libs acceptable.

My starting point is this fiddle with basic tools


Edit: I previously tried a big hand of ways without success, using .duration, window.setTimeout(function(){do_that}, time_ms), .delay() in few combinations without success. See: http://jsfiddle.net/Ka2Nh/7/

Answer:1

I would like it so that the as the user scrolls down the page and hits certain "sticky" elements, they add themselves to the top of the page. I.e., let's say the page has a fixed, 10px high element ...

I would like it so that the as the user scrolls down the page and hits certain "sticky" elements, they add themselves to the top of the page. I.e., let's say the page has a fixed, 10px high element ...

  1. jquery vs other javascript frameworks
  2. jquery and other javascript frameworks
  3. jquery breaks another javascript
  4. jquery use other javascript
  5. jquery conflict with other javascript
  6. jquery run after all other javascript

Just made a simple controller with some injection. var SimpleProductListController = BaseController.extend({ _notifications:null, _productsModel:null, init:function($scope,...

Just made a simple controller with some injection. var SimpleProductListController = BaseController.extend({ _notifications:null, _productsModel:null, init:function($scope,...

  1. what is angular js
  2. what is angular velocity
  3. what is angular acceleration
  4. what is angular 2
  5. what is angular directive
  6. what is angular component
  7. what does angular mean
  8. what is angular 4
  9. what is angular.json
  10. what is angular service
  11. what is angular observable
  12. what is angular zone
  13. what is angular router
  14. what is angular controller
  15. what is angular template
  16. what is angular typescript
  17. what is angular promise
  18. what is angular subscribe
  19. what is angular viewchild
  20. what is angular injector

I have this xml : <quran> <row> <WID>10</WID> <word>بسم</word> <SID>1</SID> <Ayeh>0</Ayeh> <...

I have this xml : <quran> <row> <WID>10</WID> <word>بسم</word> <SID>1</SID> <Ayeh>0</Ayeh> <...

I am using JQuery Mobile version 1.4.2 and at some point in one of my templates I would like to use irs filterable select menu. However there is one problem: That particular element has a specific ...

I am using JQuery Mobile version 1.4.2 and at some point in one of my templates I would like to use irs filterable select menu. However there is one problem: That particular element has a specific ...

  1. filterable multiple select with checkboxes