How do Media Keys work if you have multiple applications running?

Hi all,

Can someone help me understand how this works?

In the following example, I have two open applications that support my Media Keys — SMPlayer and Pithos.

When I press Fn + F11 to resume the playback, Pithos is resumed altough the last application I used was not Pithos but SMPlayer.

How does this work internally?