Skip to content

Video

A video plays a video file from a URI, e.g. a static resource of your application. It lives in package presentation/ui/video and maps to the HTML video element, so the supported formats depend on the browser. To embed a video platform like YouTube, use a WebView instead.

//go:embed palm.mp4
var palm application.StaticBytes

// in your configurator
palmUri := cfg.Resource(palm)

// in your view
video.Video(palmUri).
	AutoPlay(true).
	Loop(true).
	Controls(true)

Constructors

ConstructorDescription
func Video(src core.URI) TVideoCreates a video for the given source.

Methods

MethodDescription
AutoPlay(autoplay bool) TVideoStarts the playback automatically; browsers usually require Muted for that.
Controls(controls bool) TVideoShows the playback controls of the browser.
Frame(frame ui.Frame) TVideoSets the layout frame of the video.
Loop(loop bool) TVideoRestarts the video when it ends.
Muted(muted bool) TVideoMutes the audio.
PlaysInline(plays bool) TVideoPlays the video inline instead of fullscreen on mobile devices.
Poster(poster core.URI) TVideoSets an image which is shown until the video plays.
Src(src core.URI) TVideoSets the source of the video.

Related