Liking cljdoc? Tell your friends :D
ClojureScript only.

dk.simongray.play-nice.display.wake-lock

The screen kept on while a media element plays, through Screen Wake Lock.

A playing video keeps the screen on by itself, but no engine does that for audio, so a page that shows a transcript or lyrics while an episode plays goes dark:

(def stop!
  (hold-while-playing! audio))

The functions take these opts:

  • :window, the window whose navigator holds the lock, instead of the page's, e.g. a stand-in in a test
The screen kept on while a media element plays, through Screen Wake
Lock.

A playing video keeps the screen on by itself, but no engine does that
for audio, so a page that shows a transcript or lyrics while an episode
plays goes dark:

    (def stop!
      (hold-while-playing! audio))

The functions take these opts:

- :window, the window whose navigator holds the lock, instead of the
  page's, e.g. a stand-in in a test
raw docstring

hold-while-playing!cljs

(hold-while-playing! element)
(hold-while-playing! element opts)

Keep the screen on while the media element plays and its page shows, with the opts above, and return a function that stops it.

The browser lets go of the lock whenever the page is hidden, so the call requests it again when the page shows again. It lets go itself at a pause or the end. Where the browser has no Screen Wake Lock, or refuses the lock, e.g. on a low battery, the screen goes dark as it would have.

Keep the screen on while the media `element` plays and its page shows,
with the `opts` above, and return a function that stops it.

The browser lets go of the lock whenever the page is hidden, so the
call requests it again when the page shows again. It lets go itself at
a pause or the end. Where the browser has no Screen Wake Lock, or
refuses the lock, e.g. on a low battery, the screen goes dark as it
would have.
raw 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