0

I wrote my own MediaPlayer because I found no player I like, which integrates the GlobalSystemMediaTransportControlsSessions. So I wrote my own player... which also does not integrate them. So I want to change it.

So how do I register a session, pass the metadata and react on control commands (play, pause, skip next, skip previous, ...). I don't want to listen for virtual keys (like VLC) because they only work when the window is focused.

Kaskorian
  • 426
  • 3
  • 18
  • Build an UWP app? In case you just need to intercept Media Commands, see here: [Media keys in WndProc not firing](https://stackoverflow.com/a/53026949/7444103). – Jimi Mar 16 '21 at 00:49
  • But my app is no UWP app and for example, Spotify, Chrome, Firefox, ... are no UWP apps and they integrate them. So it should be possible – Kaskorian Mar 16 '21 at 00:53
  • You mean this one: [MediaPlayerElement control for Windows Forms and WPF](https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/mediaplayerelement). That documentation contain the *instruction* to use UWP Control in WPF and WinForms, using [XAML Islands](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/xaml-islands). Not sure it's enough. See the general [Windows Community Toolkit Documentation](https://learn.microsoft.com/en-us/windows/communitytoolkit/). – Jimi Mar 16 '21 at 01:07
  • @Jimi Okay I integrated the control. The session is created but I cannot control it using *TryPauseAsync*, *TryPlayAsync*, ... Also I have to fill in the metadata. How do I do this? – Kaskorian Mar 16 '21 at 02:36

0 Answers0