saltosystems / winrt-go

MIT License
35 stars 14 forks source link

feat: generate SystemMediaTransportControls related classes #88

Closed mokurin000 closed 7 months ago

mokurin000 commented 7 months ago

SystemMediaTransportControls is a class in the Universal Windows Platform (UWP) that allows developers to integrate media playback controls into their Windows apps. It provides a set of controls that allow users to play, pause, skip, and adjust the volume of media content being played within the app.

Integrating with SystemMediaTransportControls is beneficial because it provides a consistent and familiar user experience across different Windows devices. Users can control media playback using standard system controls, such as those found in the Windows taskbar or on external keyboards. This integration enhances usability and accessibility, as users can easily interact with media content without needing to navigate within the app interface. Additionally, it allows developers to focus on other aspects of their app, knowing that media playback controls are handled by the system.

jagobagascon commented 7 months ago

Seems like some class is still missing (storage.StorageFile). Add them to the PR or filter out the methods that use it.

mokurin000 commented 7 months ago

@jagobagascon Hi! Thank you for having a look, could you please re-run the sanity check?

jagobagascon commented 7 months ago

There's still a few errors. You can test it yourself by running the tests:

$ > go test github.com/saltosystems/winrt-go/...
# github.com/saltosystems/winrt-go/windows/media
windows\media\systemmediatransportcontrols.go:274:88: undefined: SystemMediaTransportControlsTimelineProperties
windows\media\systemmediatransportcontrols.go:939:87: undefined: SystemMediaTransportControlsTimelineProperties
windows\media\systemmediatransportcontrolsdisplayupdater.go:22:68: undefined: MediaPlaybackType
windows\media\systemmediatransportcontrolsdisplayupdater.go:29:71: undefined: MediaPlaybackType
windows\media\systemmediatransportcontrolsdisplayupdater.go:50:82: undefined: streams.RandomAccessStreamReference
windows\media\systemmediatransportcontrolsdisplayupdater.go:57:85: undefined: streams.RandomAccessStreamReference
windows\media\systemmediatransportcontrolsdisplayupdater.go:64:80: undefined: MusicDisplayProperties    
windows\media\systemmediatransportcontrolsdisplayupdater.go:71:80: undefined: VideoDisplayProperties    
windows\media\systemmediatransportcontrolsdisplayupdater.go:78:80: undefined: ImageDisplayProperties    
windows\media\systemmediatransportcontrolsdisplayupdater.go:127:66: undefined: MediaPlaybackType        
windows\media\systemmediatransportcontrolsdisplayupdater.go:127:66: too many errors

I encourage you to use your own fork of winrt-go in whatever project you are building, and validate your changes fit your your needs there before updating the PR.

mokurin000 commented 6 months ago

Seems like some class is still missing (storage.StorageFile). Add them to the PR or filter out the methods that use it.

Thanks for your patience and you advises

I found a strange issue: -method-filter !GetThumbnails and -method-filter !SetThumbnails doesn't work, neither of the method were ignored in the generated code, thus I have to remove them manually. I am unsure if this is a bug, or something expected

update: As in Microsoft doc, the two functions are not method, they are getter/setter for the Thumbnails property, does winrt-go have any option to ignore a property for similar scenarios?

jagobagascon commented 6 months ago

Yes, getters and setters are treated differently. You have to use the get_ and put_ prefix for them

-method-filter get_MaintainConnection -method-filter put_MaintainConnection

There are also other prefixes, like the ones used for events (add_ and remove_).

-method-filter add_Received -method-filter remove_Received