Stop music/audio that is played by other app from a dot net core winform app?

huangapple go评论56阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月15日 15:26:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76480076.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定