M
M
Mimocodil2021-06-08 19:33:37
Java
Mimocodil, 2021-06-08 19:33:37

How to stop third party players on Windows?

Android has a feature that only allows playback of one source at a time, such as YouTube videos, Telegram audio recordings, or WhatsApp voice recordings. Is it possible to implement such a function on a PC? If so, how? I'm not asking you to write all the code for me (but I won't refuse), just tell me in which direction to dig. Maybe there are already ready-made solutions or libraries?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-06-09
@Ezekiel4

There is no standard that players in windows would support for this (I think they have been trying to invent it for a bunch of years and every time something new that no one wants to support)
It seems to me that using the core audio api you can get to the application that is currently playing (get list them with IAudioSessionEnumerator ) and try sending it to IAudioClient::Stop (I couldn't figure out how to bind these objects). If I understand correctly, this is exactly what windows shows on top of the screen when you use the multimedia keys.
If it works, and if you need it from java, then either look for ready-made analogues or drink in C and connect using jni

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question