Change function of F5 Key

Ubuntu automatically enables the F5 for only the audio which was played first which means that if there are more than one audio playing, and If I would press the F5 key, ubuntu would pause the audio which was played first instead of the audio which was last played. I find this very annoying, is there any way in which I can assign the F5 key to play/pause the last played audio/video instead of the first one?