![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
Picture-in-picture keyboard controls not working properly
As far as I know there are quite a few keyboard shortcuts one can use in picture-in-picture mode. However, they don't always work for me. Most notably, spacebar often toggles the last thing I clicked in picture-in-picture mode. For example, I enter full screen mode and press spacebar to play the video, but instead it exits the full screen. Or I click on one of the "rewind" buttons, after which spacebar adopts the function of that button until I manually click play. For some reason, the arrow keys also don't always work. I suspect it's the problem of the same origin.
I also feel the need to say that this behavior is not limited to picture-in-picture. This is similar to what happens in almost all video players online and, possibly, some of the offline ones as well. I have also checked a few forums (VLC development thread and Stack Overflow) and it seems to be a common issue across many video players.
Still, if anyone knows any way to deal with this problem in Firefox picture-in-picture as a user, I would greatly appreciate it, as it interferes with multitasking a lot more than on any other players.
Wšykne wótegrona (1)
Spacebar primarily toggles the currently focused control like you have discovered, it is not a reliable play/pause switch. The PiP window needs to be focused for keyboard input to be recognized, this is most likely why shortcuts don't always work.
Dedicated media keys are preferable for playback control while multi-tasking. If your keyboard doesn't have any, you can assign the same functions to any button/combination with software like AutoHotkey.