Liking cljdoc? Tell your friends :D

dk.simongray.podcast.app.media-session

The Media Session of a browser for the episode that plays: what the lock screen and the notification show, and what their buttons and those of the headphones do, as player events for library/step.

The functions are pure. With the session namespace of the play-nice library, a player of the episode id in the media element audio wires them up like this, with a step! that runs an event through library/step and does its effects:

(session/metadata! (:metadata (library/playback @lib id)))
(session/actions!
 (zipmap (media-session/actions @lib id)
         (repeat (fn [details]
                   (run! step! (media-session/events
                                @lib id (.-currentTime audio)
                                details))))))

The next and previous buttons go where the listener's preference :track-buttons says, as profile/default-preferences has it.

The Media Session of a browser for the episode that plays: what the lock
screen and the notification show, and what their buttons and those of
the headphones do, as player events for library/step.

The functions are pure. With the session namespace of the play-nice
library, a player of the episode `id` in the media element `audio` wires
them up like this, with a step! that runs an event through library/step
and does its effects:

    (session/metadata! (:metadata (library/playback @lib id)))
    (session/actions!
     (zipmap (media-session/actions @lib id)
             (repeat (fn [details]
                       (run! step! (media-session/events
                                    @lib id (.-currentTime audio)
                                    details))))))

The next and previous buttons go where the listener's preference
:track-buttons says, as profile/default-preferences has it.
raw docstring

actionsclj/s

(actions library id)
(actions library id opts)

The actions of the Media Session that do something for the episode id of library, with the opts of library/playback: the seeks, and the next and previous buttons, unless they go to chapters and the episode has none.

The actions of the Media Session that do something for the episode `id`
of `library`, with the `opts` of library/playback: the seeks, and the
next and previous buttons, unless they go to chapters and the episode
has none.
sourceraw docstring

eventsclj/s

(events library id position details)
(events library
        id
        position
        {:keys [action seek-offset seek-time] :as details}
        opts)

The player events of library/step that the Media Session action of details asks for, on the episode id of library at position seconds, with the opts of library/playback. The details are those of MediaSessionActionDetails as a map in kebab-case, with the action as a keyword, e.g. {:action :seekto :seek-time 754}.

The first event reports the position, and the next one moves:

  • a seek back or forward goes the :seek-offset of the details, or else the amount that the listener prefers
  • a seek to a time goes to its :seek-time
  • the next and previous buttons go to chapters or episodes of the queue, as the listener's :track-buttons say. The previous button restarts the episode or chapter, but goes to the one before in its first few seconds, and the next button does nothing after the last chapter, unless the buttons go to the queue once no chapter is left.

Another action gives no events.

The player events of library/step that the Media Session action of
`details` asks for, on the episode `id` of `library` at `position`
seconds, with the `opts` of library/playback. The details are those of
MediaSessionActionDetails as a map in kebab-case, with the action as a
keyword, e.g. {:action :seekto :seek-time 754}.

The first event reports the position, and the next one moves:

- a seek back or forward goes the :seek-offset of the details, or else
  the amount that the listener prefers
- a seek to a time goes to its :seek-time
- the next and previous buttons go to chapters or episodes of the
  queue, as the listener's :track-buttons say. The previous button
  restarts the episode or chapter, but goes to the one before in its
  first few seconds, and the next button does nothing after the last
  chapter, unless the buttons go to the queue once no chapter is left.

Another action gives no events.
sourceraw docstring

seek-actionsclj/s

The actions that move within the episode.

The actions that move within the episode.
sourceraw docstring

track-actionsclj/s

The actions of the next and previous buttons.

The actions of the next and previous buttons.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close