Currently, there is no hook which happens when the playback actually starts. The on_preloaded hook is insufficient for many cases, as many track information are unavailable at that stage. This makes it impossible to act on certain track metadata before the media is shown to the user, so the user will see the media before action for a brief moment before the properties are notified and options are changed. This adds the on_loaded hook which allows the mentioned information available.
mpv lua scripts
The lua scripts in this folder can be loaded on a one-time basis by adding the option
--script=/path/to/script.lua
to mpv's command line.
Where appropriate, they may also be placed in ~/.config/mpv/scripts/ from where they will be automatically loaded when mpv starts.
This is only a small selection of internally maintained scripts. Some of them are just for testing mpv internals, or serve as examples. An extensive user-edited list of 3rd party scripts is available here:
https://github.com/mpv-player/mpv/wiki/User-Scripts
(Anyone can add their own scripts to that list.)