video

package
v0.3.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<video")
	TagClose = []byte("</video>")

	AttrSrc                     = []byte(" src=\"")
	AttrAutoplay                = []byte(" autoplay")
	AttrControls                = []byte(" controls")
	AttrHeight                  = []byte(" height=\"")
	AttrWidth                   = []byte(" width=\"")
	AttrLoop                    = []byte(" loop")
	AttrMuted                   = []byte(" muted")
	AttrPoster                  = []byte(" poster=\"")
	AttrPreload                 = []byte(" preload=\"")
	AttrLoading                 = []byte(" loading=\"")
	AttrCrossOrigin             = []byte(" crossorigin=\"")
	AttrControlsList            = []byte(" controlslist=\"")
	AttrDisablePictureInPicture = []byte(" disablepictureinpicture")
	AttrDisableRemotePlayback   = []byte(" disableremoteplayback")
	AttrPlaysInline             = []byte(" playsinline")
)

Byte constants for HTML rendering.

Functions

func New

func New(nodes ...node.Node) *element

New Creates a new video element with optional child nodes Example: video.New() Renders: <video></video>

func PreloadAuto

func PreloadAuto(nodes ...node.Node) *element

PreloadAuto Creates a video element with preload="auto" (loads entire video) Example: video.PreloadAuto() Renders: <video preload="auto"></video>

func PreloadMetadata

func PreloadMetadata(nodes ...node.Node) *element

PreloadMetadata Creates a video element with preload="metadata" (loads only metadata) Example: video.PreloadMetadata() Renders: <video preload="metadata"></video>

func PreloadNone

func PreloadNone(nodes ...node.Node) *element

PreloadNone Creates a video element with preload="none" (no preloading) Example: video.PreloadNone() Renders: <video preload="none"></video>

func RawText

func RawText(content string) *element

RawText Creates a new video element with raw fallback text content. Uses text.RawText which is not HTML-escaped. Example: video.RawText("<p>Your browser does not support video.</p>") Renders: <video><p>Your browser does not support video.</p></video>

func RawTextf

func RawTextf(format string, args ...any) *element

RawTextf Creates a new video element with formatted raw fallback text content. Uses text.RawTextf which is not HTML-escaped. Example: video.RawTextf("<p>Cannot play <strong>%s</strong></p>", "movie.mp4") Renders: <video><p>Cannot play <strong>movie.mp4</strong></p></video>

func Src

func Src(src string, nodes ...node.Node) *element

Src Creates a new video element with src attribute and optional child nodes Example: video.Src("report.pdf") Renders: <video src="report.pdf"></video>

func Static

func Static(content string) *element

Static Creates a new video element with static fallback text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: video.Static("Video not supported.") Renders: <video>Video not supported.</video>

func Text

func Text(content string) *element

Text Creates a new video element with fallback text content. Uses text.Text which HTML-escapes the output. Example: video.Text("Your browser does not support video.") Renders: <video>Your browser does not support video.</video>

func Textf

func Textf(format string, args ...any) *element

Textf Creates a new video element with formatted fallback text content. Uses text.Textf which HTML-escapes the output. Example: video.Textf("Cannot play %s", "movie.mp4") Renders: <video>Cannot play movie.mp4</video>

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL