问题描述
我编写了一个程序,该程序应与其他播放器一起使用,并检索有关当前播放歌曲的信息.该播放器是使用UWP编写的,因此Windows知道正在播放的曲目,因此在更改音量时我可以看到它的名称和其他信息:
I write a some program that should work with another player and retrieve info about current playing song. That player is written using UWP, so Windows knows what track is playing, so i can see it's name and other info when changing volume:
https://i.imgur.com/nNy16Gs.png
我尝试过的事情:
var systemMediaControls = SystemMediaTransportControls.GetForCurrentView();
来自从Microsoft Groove音乐应用程序获取当前的播放曲目信息
不幸的是,据我所知,它仅适用于本地媒体,可通过我的应用播放.
Unfortunately, as I understand, it's just for local media, playing from my app.
由于相同的原因,后台媒体播放器也没有帮助.
Background media player doesn't helped too because of same reason.
是否可以从Windows上获得它?或者我应该直接读取该播放器的内存,对吗?
Is it possible at all to get it from Windows? Or I should directly read memory of that player, heh?
推荐答案
音乐应用程序显示的屏幕控制栏不受系统控制,而是属于应用程序本身.
The screen control bar displayed by the music application is not controlled by the system but belongs to the application itself.
您无法通过其他音乐软件来播放音乐,就像无法从其他应用程序的应用程序文件夹中获取文件一样.
You don't have a way to get playing music in other music software just as you can't get files from the application folder of other applications.
无论如何,如果您只想从操作系统中获取当前歌曲,则没有此类API.
Anyway, if you just want to get current song from OS, there’s no such API.
最诚挚的问候.
这篇关于使用SystemMediaTransportControls从其他应用程序获取当前播放的歌曲信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!