Skip to main content

The PreTeXt Guide

Subsection 4.29.1 Video Element

The <video> element is used to embed a video in output formed from HTML. Subsections below describe the different ways to indicate the source of the video. The video may be placed inside a <figure> or can be a panel of a <sidebyside>. The former will have a caption, be numbered, and hence can be the target of a cross-reference (<xref>). The latter is anonymous, but allows for horizontal layout, and combinations with other panels.
Size is controlled by a @width attribute expressed as a percentage (on the <video> element when used in a figure, or as part of the <sidebyside> layout parameters). Height is controlled by giving the aspect ratio with the @aspect attribute on the <video> element. The value can be a ratio expressed like 4:3 or a decimal number computed from the width divided by the height, such as 1.333. The default for videos is a 16:9 aspect ratio, which is very common, so you may not need to specify this attribute.
Options include specifying a @start and an @end in seconds as integers (no units) if you only want to highlight a key portion of a video. The @play-at attribute can take the following values
Play in place (the default action).
Play in new window or tab, at 150% width.
Provide the reader the choice of the other two options.
In an educational setting, sometimes the preview images provided by YouTube can be distracting, or for an author-provided video you may wish to provide your own preview image. The @preview attribute can take on the following values
PreTeXt supplies a Play-button image.
Whatever the video playback provides. This is identical to simply not including @attribute at all
Path to an image file
Typically, this will be a relative path, starting with images/. This image will be used as preview for the online version and the print version.