Liking cljdoc? Tell your friends :D

dk.simongray.play-nice.display.fullscreen

Fullscreen of a player, with the fallback that an iPhone needs, where only a video element itself can go fullscreen, in the system's own player.

The functions take these opts:

  • :video, the video element of the player, for that fallback

    (-> (enter! player {:video video :orientation :landscape}) (.then #(swap! page assoc :fullscreen %))) ;; {:fullscreen :element :orientation {:refused :not-supported}} ;; on a desktop, or {:fullscreen :video …} on an iPhone

Fullscreen of a player, with the fallback that an iPhone needs, where
only a video element itself can go fullscreen, in the system's own
player.

The functions take these opts:

- :video, the video element of the player, for that fallback

    (-> (enter! player {:video video :orientation :landscape})
        (.then #(swap! page assoc :fullscreen %)))
    ;; {:fullscreen :element :orientation {:refused :not-supported}}
    ;; on a desktop, or {:fullscreen :video …} on an iPhone
raw docstring

dk.simongray.play-nice.display.picture-in-picture

Picture-in-Picture of a video: whether it's available, entering and leaving it, and the size of its window, as data.

Each engine refuses a video in its own words, e.g. a video with disablePictureInPicture throws an InvalidStateError in Chrome and Firefox, but a NotSupportedError in WebKit. So enter! checks the video first, and answers with one keyword for each cause:

(-> (enter! video)
    (.then prn))
;; prints {:picture-in-picture true :width 320 :height 180}, or e.g.
;; {:refused :not-allowed}

To keep track of whether the video is in Picture-in-Picture, use watch!, which also sees the user close the window.

Picture-in-Picture of a video: whether it's available, entering and
leaving it, and the size of its window, as data.

Each engine refuses a video in its own words, e.g. a video with
disablePictureInPicture throws an InvalidStateError in Chrome and
Firefox, but a NotSupportedError in WebKit. So enter! checks the video
first, and answers with one keyword for each cause:

    (-> (enter! video)
        (.then prn))
    ;; prints {:picture-in-picture true :width 320 :height 180}, or e.g.
    ;; {:refused :not-allowed}

To keep track of whether the video is in Picture-in-Picture, use
watch!, which also sees the user close the window.
raw docstring

dk.simongray.play-nice.display.remote-playback

Casting and AirPlay of a media element, from Remote Playback: whether a device is available, the browser's picker of devices, and the connection to one, as data.

Firefox has no Remote Playback, so there no device is available and prompt! answers {:refused :not-supported}. WebKit also fires its older AirPlay events, which watch! follows as well, since Video.js finds the standard events unreliable in Safari.

Casting and AirPlay of a media element, from Remote Playback: whether a
device is available, the browser's picker of devices, and the connection
to one, as data.

Firefox has no Remote Playback, so there no device is available and
prompt! answers {:refused :not-supported}. WebKit also fires its older
AirPlay events, which watch! follows as well, since Video.js finds the
standard events unreliable in Safari.
raw docstring

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

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