Is it possible to query the metadata that is displayed when playing music on Windows 10?
While I found information about displaying the metadata from a MediaPlayer
with SMTC and such, I can't find any way for a process (which doesn't play any media itself) to simply read out that same metadata.
There's a .NET Framework wrapper that's able to accomplish this called WindowsMediaController.
It does it by utilizing the Windows.SDK.Contracts package to use Windows Runtime APIs in .NET Framework.
Here's a basic implementation that will print the currently playing media:
using System;
using Windows.Media.Control;
//
public static void PrintCurrentlyPlaying()
{
var sessionManager = GlobalSystemMediaTransportControlsSessionManager.RequestAsync().GetAwaiter().GetResult();
var currentSession = sessionManager.GetCurrentSession();
var mediaProperties = currentSession.TryGetMediaPropertiesAsync().GetAwaiter().GetResult();
Console.WriteLine($"Playing {mediaProperties.Title} by {mediaProperties.Artist}");
}
This currently isn't possible, as there isn't an API that I know about that offers this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With