fyne-widgets/examples/bufferedvid/main.go

37 lines
921 B
Go

package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"git.martyn.berlin/martyn/fyne-widgets/pkg/bufferedvid"
"git.martyn.berlin/martyn/fyne-widgets/pkg/layouts"
)
var videoWidget *bufferedvid.BufferedVidPlayback
func unimplemented() {}
func main() {
a := app.New()
w := a.NewWindow("Video")
videoWidget = bufferedvid.NewBufferedVidPlayback()
videoWidget.VideoFilename = "1 Minute Timer-CH50zuS8DD0.mp4"
layout := layouts.NewFloatingControlsLayout()
layout.FloatingControlsLocation = layouts.FloatingControlsCenter
buttons := container.NewHBox(widget.NewButton(">", func() { videoWidget.Play() }), widget.NewButton("||", func() {
if videoWidget.IsPaused() {
videoWidget.UnPause()
} else {
videoWidget.Pause()
}
}))
w.SetContent(container.New(&layout, videoWidget, buttons))
w.Resize(fyne.NewSize(640, 480))
w.ShowAndRun()
}