UPDATE: As of August 2019, this AHK script is no longer necessary. Plex appears to be able to receive media hotkeys natively now! (Thanks to BlayZin for the heads-up).
The AutoHotkey script above stopped working for me recently on Windows 10 v1803 (build 17134.81). Don’t know if it was a change in AHK (currently v1.1.29.01) or Windows that caused the script to not work, but it appears that Plex Media Player was not properly receiving the commands. I updated the script to target the ahk_parent Control and the PlexMediaPlayer.exe application, and that seems to have fixed all of the issues on my system.
#NoEnv
#NoTrayIcon
SendMode Input
; Send media key inputs to Plex when it is available and isn't the focused application
#IfWinExist, ahk_exe PlexMediaPlayer.exe
#IfWinNotActive, ahk_exe PlexMediaPlayer.exe
~Media_Next::
ControlSend, ahk_parent, {Media_Next}, ahk_exe PlexMediaPlayer.exe
return
~Media_Prev::
ControlSend, ahk_parent, {Media_Prev}, ahk_exe PlexMediaPlayer.exe
return
~Media_Stop::
ControlSend, ahk_parent, {Media_Stop}, ahk_exe PlexMediaPlayer.exe
return
~Media_Play_Pause::
ControlSend, ahk_parent, {Media_Play_Pause}, ahk_exe PlexMediaPlayer.exe
return
#IfWinNotActive
#IfWinExist