英文:
Stop music/audio that is played by other app from a dot net core winform app?
问题
A remote bluetooth headset is playing audio from computer. E.g., browser, spotify audio to a bluetooth headset. We want to stop/ pause music/audio from our app. How can we do it?
Searched for methods but did not find solution.
英文:
A remote bluetooth headset is playing audio from computer. E.g., browser, spotify audio to a bluetooth headset. We want to stop/ pause music/audio from our app. How can we do it?
Searched for methods but did not find solution.
答案1
得分: 2
UWP应用运行在一个与系统隔离的沙箱中,无法访问其他应用程序的进程,并且在访问系统资源时受到限制。因此,您无法停止/暂停由系统或其他应用程序播放的音乐/音频。
WinForm
您可以使用Win32 API keybd_event 来模拟暂停键输入,使用的键码是 VK_MEDIA_PLAY_PAUSE
。
英文:
UWP
UWP apps are running in sandbox which are isolated from system, UWP cannot access other app's process and is restricted when accessing system resources.
So, you can't stop/pause music/audio played by system or other Apps.
WinForm
You can use Win32 API keybd_event with VK_MEDIA_PLAY_PAUSE
to simulate pause key input.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论