How to edit context menu on right click in reviewer?

check the html source code of the reviewer and what the media buttons do. They send some code to python with pycmd. on the python side in aqt/reviewer.py you have a a linkhandler command that catches those “signals” coming from js, see anki/qt/aqt/reviewer.py at fd013f68d2de8cfc58a6f4ecce4519e6c3acd260 · ankitects/anki · GitHub

 

To learn about the reviewer webview there’s:

You can now debug the webviews using an external Chrome instance, by setting the env var QTWEBENGINE_REMOTE_DEBUGGING to 8080 prior to starting Anki, then surfing to localhost:8080 in Chrome.

Porting 2.0 Add-ons - Writing Anki Add-ons. this is also in an add-on named AnkiWebView Inspector.

 

To send the pycmd play in the webview side I guess you have some sort of clickable hyperlink where the target is maybe a js function that emits play: … So when you right click the button you maybe have this link data and - similar to my hyperlink detection in my add hyperlink add-on - you can analyze each link clicked