diff options
| author | julian laplace <julescarbon@gmail.com> | 2022-11-07 15:19:36 +0100 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2022-11-07 15:19:36 +0100 |
| commit | 4f87b6f9eef43eb83b25a71449aac2ee27746173 (patch) | |
| tree | 324da423d6fcf384562b989e3dbad0cd5c29a59c /public/assets/js/lib/views/details | |
| parent | 9c6e43a47e171a183c1b7b7033f6ec1b0a23a216 (diff) | |
next unless finished
Diffstat (limited to 'public/assets/js/lib/views/details')
| -rw-r--r-- | public/assets/js/lib/views/details/audio.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/public/assets/js/lib/views/details/audio.js b/public/assets/js/lib/views/details/audio.js index 4fd02aa..0b8d9bc 100644 --- a/public/assets/js/lib/views/details/audio.js +++ b/public/assets/js/lib/views/details/audio.js @@ -50,7 +50,7 @@ const audio = (function () { } }); } - console.log(music); + // console.log(music); if (playing) { audio.set_cursor(); } @@ -62,6 +62,7 @@ const audio = (function () { audio.el = document.createElement("audio"); audio.el.setAttribute("controls", true); // audio.el.addEventListener("loadeddata", () => { if (selected) audio.el.play() }) + audio.el.addEventListener("ended", this.nextUnlessFinished.bind(this)); parent.appendChild(audio.el); document.body.addEventListener("keydown", audio.keydown); }; @@ -129,6 +130,12 @@ const audio = (function () { audio.play(current_index + 1); }; + audio.nextUnlessFinished = function () { + if (current_index < music.length - 1) { + audio.next(); + } + }; + audio.keydown = function (event) { function element_is_text_input(element) { var tagName = element.tagName.toLowerCase(); |
