Video
How to embed a video file with cfg.Resource and play it with video.Video, including autoplay, loop and controls.

package main
import (
_ "embed"
"go.wdy.de/nago/application"
"go.wdy.de/nago/presentation/core"
"go.wdy.de/nago/presentation/ui"
"go.wdy.de/nago/presentation/ui/video"
"go.wdy.de/nago/web/vuejs"
)
//go:embed palm.mp4
var palm application.StaticBytes
func main() {
application.Configure(func(cfg *application.Configurator) {
cfg.SetApplicationID("de.worldiety.tutorial_72")
cfg.Serve(vuejs.Dist())
palmUri := cfg.Resource(palm)
cfg.RootView(".", func(wnd core.Window) core.View {
return ui.VStack(
video.Video(palmUri).
AutoPlay(true).
Loop(true).
Controls(true),
).Frame(ui.Frame{}.MatchScreen())
})
}).Run()
}
View on GitHub ↗
· run it with go run go.wdy.de/nago/example/cmd/tutorial-72-video@latest