Liking cljdoc? Tell your friends :D

dk.simongray.webvtt

Parse, write and check WebVTT files, as the W3C's WebVTT spec defines them.

A file is a plain map of the parts it has:

  • :header, the text from WEBVTT to the first blank line, when there's more to it than WEBVTT (e.g. the X-TIMESTAMP-MAP of an HLS segment)
  • :regions, a vector of region maps
  • :stylesheets, a vector of the text of each STYLE block
  • :cues, a vector of cue maps

A cue or a region only has the attributes that differ from the spec's defaults, which cue-defaults and region-defaults hold. A cue always has a :start-time and an :end-time in seconds. Its :text is the cue text as written.

The functions that parse cue text take a cue or its text. The tree that hiccup returns looks like this:

[[:v {:voice "Bob" :class ["loud"]}
  "Hi " [:timestamp {:time 2.0}] [:i {} "there"]]]

The elements are named after the tags of cue text: :c, :i, :b, :u, :ruby, :rt, :v and :lang. Each has an attribute map, which holds its :class when it has classes, and the :voice of a :v or the :lang of a :lang. An inline timestamp is an empty :timestamp element whose :time is when the text after it is spoken.

Parse, write and check WebVTT files, as the W3C's WebVTT spec defines
them.

A file is a plain map of the parts it has:

- :header, the text from WEBVTT to the first blank line, when there's
  more to it than WEBVTT (e.g. the X-TIMESTAMP-MAP of an HLS segment)
- :regions, a vector of region maps
- :stylesheets, a vector of the text of each STYLE block
- :cues, a vector of cue maps

A cue or a region only has the attributes that differ from the spec's
defaults, which cue-defaults and region-defaults hold. A cue always has
a :start-time and an :end-time in seconds. Its :text is the cue text as
written.

The functions that parse cue text take a cue or its text. The tree that
hiccup returns looks like this:

    [[:v {:voice "Bob" :class ["loud"]}
      "Hi " [:timestamp {:time 2.0}] [:i {} "there"]]]

The elements are named after the tags of cue text: :c, :i, :b, :u,
:ruby, :rt, :v and :lang. Each has an attribute map, which holds its
:class when it has classes, and the :voice of a :v or the :lang of a
:lang. An inline timestamp is an empty :timestamp element whose :time is
when the text after it is spoken.
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