type WindowHandleMagic interface { Wid() uintptr }
// need to apply patch first func GetWindowHandle(window fyne.Window) uintptr { x, ok := window.(WindowHandleMagic) if ok { return x.Wid() } return 0 }
func main() { a := app.NewWithID("io.fyne.mpvdemo") a.SetIcon(theme.FyneLogo()) window := a.NewWindow("Fyne MPV Player Demo") var libmpv *mpv.Mpv = nil window.Resize(fyne.NewSize(1080, 720)) go func() { wid := GetWindowHandle(window) for wid == 0 { wid = GetWindowHandle(window) } fmt.Printf("got windows handle %d\n", wid) libmpv = mpv.Create() err := libmpv.Initialize() if err != nil { panic(err) } fmt.Println(libmpv.SetOptionString("wid", fmt.Sprintf("%d", wid))) fmt.Println(libmpv.Command([]string{"loadfile", "/home/aynakeya/Videos/ymca.mp4"})) }() window.ShowAndRun() if libmpv != nil { libmpv.Destroy() } }