Get current track information from the Microsoft Groove Music app

I would like to receive information about the current game track in the Microsoft Groove application in my own application. I'm talking about Groove APP, not REST Api.

My first approach was to try to get Windows.Media.Playback.BackgroundMediaPlayer(now obsolete) information from my own process (application). Learn more about Windows.Media.Playback.BackgroundMediaPlayerin the Documentation Dev Center

The idea was to get information from BackgroundMediaPlayer.Current, but it only works in the same process. And again, this is deprecated anyway, now MS recommends using the class Windows.Media.Playback.MediaPlayer, but it is also only available in the same process that uses MediaPlayer.

The second approach is to get information from System Transport Transport Controls .

For those who are not familiar with SMTC, here's what I'm talking about (a small pop-up window when you skip / play / pause from the keyboard):

enter image description here

The article on SMTC above shows how to use these controls in your application, what I want to do is basically the exact opposite.

Does anyone have another approach that you think might work?

change

So, I found out that this is possible using my own interface ISystemMediaTransportControlsInterop:

https://msdn.microsoft.com/en-us/library/windows/desktop/dn892315(v=vs.85).aspx

more precisely the method ISystemMediaTransportControlsInterop::GetForWindow:

https://msdn.microsoft.com/en-us/library/windows/desktop/dn892316(v=vs.85).aspx

, , (dll), () pInvoke #.

, SDK Windows 10, , .

, , , , # ( ++-). , pInvoke.

, - .

+5
2

https://docs.microsoft.com/en-us/uwp/api/Windows.Media.SystemMediaTransportControls

SystemMediaTransportControls _control = SystemMediaTransportControls.GetForCurrentView();

Windows.Foundation.UniversalApiContract.winmd - , SMTC.

, .

<Reference Include="Windows.Foundation.UniversalApiContract"> <HintPath>C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\3‌​.0.0.0\Windows.Found‌​ation.UniversalApiCo‌​ntract.winmd</HintPa‌​th> </Reference>

.

, , , "Windows.Media".

0

?

WPF/#

0

Source: https://habr.com/ru/post/1686361/


All Articles