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

Implement custom progress indicator and seeking

Squashed commit of the following:

commit 23b9a3deac564bf3753a00238784a6045cb50d46
Author: Arne Schlüter <arne@schlueter.is>
Date:   Sun Oct 14 10:20:08 2018 +0200

    Enable seeking in buffered part and fix drawn x value

commit 9ce4b0941f4a57286f608d2b155658672cac3817
Author: Arne Schlüter <arne@schlueter.is>
Date:   Sun Oct 14 09:40:43 2018 +0200

    Draw seek position and enable seeking played part by click

commit 58cbf2d8035c0eeacaed3da7a68f97d94db4a2b6
Author: Arne Schlüter <arne@schlueter.is>
Date:   Thu Oct 11 21:42:57 2018 +0200

    Add retina canvas

commit 6acb84a67e4bee61e5b9ae6eb15e8159e0431662
Author: Arne Schlüter <arne@schlueter.is>
Date:   Wed Oct 10 17:52:43 2018 +0200

    Implement canvas progress bar
This commit is contained in:
Arne Schlüter 2018-10-14 10:31:47 +02:00
commit 513169ea71
9 changed files with 211 additions and 74 deletions

View file

@ -14,11 +14,13 @@
"Takes an audio object and returns a map describing its current status"
[elem]
{:ended? (.-ended elem)
:loop? (.-loop elem)
:muted? (.-muted elem)
:paused? (.-paused elem)
:current-src (.-currentSrc elem)
:current-time (.-currentTime elem)})
:current-time (.-currentTime elem)
:seekable (let [seekable (.-seekable elem)]
(if (> (.-length seekable) 0)
(.end seekable (dec (.-length seekable)))
0))})
; explanation of these events: https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics
@ -60,6 +62,12 @@
(.play a)
(.pause a)))))
(re-frame/reg-fx
:audio/seek
(fn [[percentage duration]]
(set! (. @audio -currentTime)
(* percentage duration))))
;; subscriptions
(defn summary