diff options
| author | julian laplace <julescarbon@gmail.com> | 2022-11-01 19:08:25 +0100 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2022-11-01 19:08:25 +0100 |
| commit | b17710f4b9bec8fbeccd08da94e709d8def4f6b9 (patch) | |
| tree | 721d70f89a1ea09a84ef11003d28ed5341f8a96f /public/assets/js/lib/views/details/audio.js | |
| parent | 029152a503b80b265cdd5f9e8e189873ede34919 (diff) | |
fixing audio player
Diffstat (limited to 'public/assets/js/lib/views/details/audio.js')
| -rw-r--r-- | public/assets/js/lib/views/details/audio.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/public/assets/js/lib/views/details/audio.js b/public/assets/js/lib/views/details/audio.js index 1c2f6f0..4fd02aa 100644 --- a/public/assets/js/lib/views/details/audio.js +++ b/public/assets/js/lib/views/details/audio.js @@ -79,8 +79,11 @@ const audio = (function () { }; audio.play = function (index) { - playing = true; current_index = (parseInt(index) + music.length) % music.length; + if (!music[current_index]) { + return; + } + playing = true; audio.el.src = music[current_index].href; audio.el.play(); audio.set_cursor(); @@ -99,7 +102,7 @@ const audio = (function () { audio.toggle = function () { if (audio.el.paused) { audio.el.play(); - if (ui) { + if (ui && music[current_index]) { ui.onPlay(music[current_index]); } } else { @@ -139,6 +142,7 @@ const audio = (function () { return; } if (app.typing || event.ctrlKey || event.altKey || event.metaKey) return; + if (!music[current_index]) return; switch (event.keyCode) { case 37: // left if (event.shiftKey) { |
