Start playback at the playhead
This commit is contained in:
parent
6df315b73d
commit
981bef98f9
1 changed files with 10 additions and 2 deletions
|
|
@ -67,7 +67,7 @@
|
||||||
::play
|
::play
|
||||||
(fn [{:keys [db]} _]
|
(fn [{:keys [db]} _]
|
||||||
{:db (assoc-in db [:playback :playing?] true)
|
{:db (assoc-in db [:playback :playing?] true)
|
||||||
::play! nil}))
|
::play-from! [(fps db) (frames db) (get-in db [:playback :frame] 0)]}))
|
||||||
|
|
||||||
(rf/reg-event-fx
|
(rf/reg-event-fx
|
||||||
::pause
|
::pause
|
||||||
|
|
@ -80,7 +80,8 @@
|
||||||
(fn [{:keys [db]} _]
|
(fn [{:keys [db]} _]
|
||||||
(if (get-in db [:playback :playing?])
|
(if (get-in db [:playback :playing?])
|
||||||
{:db (assoc-in db [:playback :playing?] false) ::pause! nil}
|
{:db (assoc-in db [:playback :playing?] false) ::pause! nil}
|
||||||
{:db (assoc-in db [:playback :playing?] true) ::play! nil})))
|
{:db (assoc-in db [:playback :playing?] true)
|
||||||
|
::play-from! [(fps db) (frames db) (get-in db [:playback :frame] 0)]})))
|
||||||
|
|
||||||
(rf/reg-event-fx
|
(rf/reg-event-fx
|
||||||
::seek
|
::seek
|
||||||
|
|
@ -103,6 +104,13 @@
|
||||||
;; --- effects: every DOM touch on the audio element is one of these ---
|
;; --- effects: every DOM touch on the audio element is one of these ---
|
||||||
|
|
||||||
(rf/reg-fx ::play! (fn [_] (clock/play!)))
|
(rf/reg-fx ::play! (fn [_] (clock/play!)))
|
||||||
|
(rf/reg-fx ::play-from!
|
||||||
|
(fn [[fps frames f]]
|
||||||
|
;; The transport is the audio clock; app-db's frame is the visible
|
||||||
|
;; playhead. Re-anchor before starting so Play always honors the frame
|
||||||
|
;; currently shown, including after the clock has reached the clip end.
|
||||||
|
(clock/seek! fps frames f)
|
||||||
|
(clock/play!)))
|
||||||
(rf/reg-fx ::pause! (fn [_] (clock/pause!)))
|
(rf/reg-fx ::pause! (fn [_] (clock/pause!)))
|
||||||
(rf/reg-fx ::rate! (fn [r] (clock/set-rate! r)))
|
(rf/reg-fx ::rate! (fn [r] (clock/set-rate! r)))
|
||||||
(rf/reg-fx ::seek! (fn [[fps frames f]] (clock/seek! fps frames f)))
|
(rf/reg-fx ::seek! (fn [[fps frames f]] (clock/seek! fps frames f)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue