When calling the GetCurrentSession() method:
var manager = winrt.GlobalSystemMediaTransportControlsSessionManager{}
var session = manager.GetCurrentSession()
An error occurs:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0xc0c046]
goroutine 1 [running]:
github.com/zzl/go-winrtapi/winrt.(*IGlobalSystemMediaTransportControlsSessionManager).Vtbl(...)
D:/GoLandProjets/GoPath/pkg/mod/github.com/zzl/go-winrtapi@v1.0.0/winrt/Media.Control.go:332
github.com/zzl/go-winrtapi/winrt.(*IGlobalSystemMediaTransportControlsSessionManager).GetCurrentSession(0xb6623d?)
D:/GoLandProjets/GoPath/pkg/mod/github.com/zzl/go-winrtapi@v1.0.0/winrt/Media.Control.go:337 +0x26
main.mediaIsPlaying()
D:/GoLandProjets/Ximely/wmc.go:10 +0x15
main.main()
D:/GoLandProjets/Ximely/wmc.go:19 +0x13
exit status 2