1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-07 02:33:39 +02:00

Fix playlist skipping multiple songs when current song has ended

This commit is contained in:
Arne Schlüter 2018-10-09 19:11:10 +02:00
commit 58327be930
3 changed files with 8 additions and 6 deletions

View file

@ -3,7 +3,8 @@
and receive information about the current playback status so we can use it in and receive information about the current playback status so we can use it in
our re-frame app." our re-frame app."
(:require [re-frame.core :as re-frame] (:require [re-frame.core :as re-frame]
[airsonic-ui.audio.playlist :as playlist])) [airsonic-ui.audio.playlist :as playlist]
[goog.functions :refer [throttle]]))
;; TODO: Manage buffering ;; TODO: Manage buffering
@ -20,9 +21,12 @@
:current-time (.-currentTime elem)}) :current-time (.-currentTime elem)})
; explanation of these events: https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics ; explanation of these events: https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics
(defn attach-listeners! [el] (defn attach-listeners! [el]
(doseq [event ["loadstart" "progress" "play" "timeupdate" "pause"]] (let [emit-audio-update (throttle #(re-frame/dispatch [:audio/update (->status el)]) 16)]
(.addEventListener el event #(re-frame/dispatch [:audio/update (->status el)])))) (doseq [event ["loadstart" "progress" "play" "timeupdate" "pause"]]
(.addEventListener el event emit-audio-update))))
;; effects to be fired from event handlers ;; effects to be fired from event handlers

View file

@ -12,8 +12,6 @@
{:audio/play (api/stream-url (:credentials db) (playlist/peek playlist)) {:audio/play (api/stream-url (:credentials db) (playlist/peek playlist))
:db (assoc-in db [:audio :playlist] playlist)}))) :db (assoc-in db [:audio :playlist] playlist)})))
;; FIXME: :audio/play might not get the right argument here
(re-frame/reg-event-db (re-frame/reg-event-db
:audio-player/set-playback-mode :audio-player/set-playback-mode
(fn [db [_ playback-mode]] (fn [db [_ playback-mode]]

View file

@ -68,7 +68,7 @@
[:div.navbar-item [search/form]]] [:div.navbar-item [search/form]]]
[:div.navbar-end [:div.navbar-end
[:a.navbar-item {:href (url-for ::routes/current-queue) [:a.navbar-item {:href (url-for ::routes/current-queue)
:title "Current queue"} [icon :audio]] :title "Current queue"} [icon :audio-spectrum]]
(when stream-role (when stream-role
[navbar-dropdown "Library" [navbar-dropdown "Library"
[[{:href (url-for ::routes/library {:criteria "recent"})} "Recently played"] [[{:href (url-for ::routes/library {:criteria "recent"})} "Recently played"]