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:
parent
925c35bf5a
commit
58327be930
3 changed files with 8 additions and 6 deletions
|
|
@ -3,7 +3,8 @@
|
|||
and receive information about the current playback status so we can use it in
|
||||
our re-frame app."
|
||||
(: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
|
||||
|
||||
|
|
@ -20,9 +21,12 @@
|
|||
:current-time (.-currentTime elem)})
|
||||
|
||||
; explanation of these events: https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics
|
||||
|
||||
|
||||
(defn attach-listeners! [el]
|
||||
(let [emit-audio-update (throttle #(re-frame/dispatch [:audio/update (->status el)]) 16)]
|
||||
(doseq [event ["loadstart" "progress" "play" "timeupdate" "pause"]]
|
||||
(.addEventListener el event #(re-frame/dispatch [:audio/update (->status el)]))))
|
||||
(.addEventListener el event emit-audio-update))))
|
||||
|
||||
;; effects to be fired from event handlers
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@
|
|||
{:audio/play (api/stream-url (:credentials db) (playlist/peek playlist))
|
||||
:db (assoc-in db [:audio :playlist] playlist)})))
|
||||
|
||||
;; FIXME: :audio/play might not get the right argument here
|
||||
|
||||
(re-frame/reg-event-db
|
||||
:audio-player/set-playback-mode
|
||||
(fn [db [_ playback-mode]]
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
[:div.navbar-item [search/form]]]
|
||||
[:div.navbar-end
|
||||
[:a.navbar-item {:href (url-for ::routes/current-queue)
|
||||
:title "Current queue"} [icon :audio]]
|
||||
:title "Current queue"} [icon :audio-spectrum]]
|
||||
(when stream-role
|
||||
[navbar-dropdown "Library"
|
||||
[[{:href (url-for ::routes/library {:criteria "recent"})} "Recently played"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue