{ pkgs, flakes, ... }:
{
  #home.packages = with pkgs; [ mpv ];

  programs.mpv.enable = true;
  programs.mpv.bindings."n"       = "sub-seek  1";
  programs.mpv.bindings."SHIFT+n" = "sub-seek -1";
  programs.mpv.bindings."b"       = ''cycle-values audio-channels 2 "auto"'';

  programs.mpv.scripts = with pkgs.mpvScripts; [
    #thumbnail # TOO SLOW
    thumbfast
    mpris
    # TODO: thumbfast
    flakes.self.pkgs.mpv-webm # activate with SHIFT+W
    # from https://github.com/mpv-player/mpv/issues/9767#issuecomment-1024831645
    ({ scriptName = "dynamic-subs.lua"; } // (pkgs.writeTextDir "share/mpv/scripts/dynamic-subs.lua" ''
      mp.add_hook('on_load', 10, function()
        sub_paths = {'Subs'}
        sub_paths[#sub_paths+1]='Subs/' .. mp.get_property('filename/no-ext')
        mp.set_property_native('sub-file-paths', sub_paths)
      end)
    ''))
  ];
  #programs.mpv.config.osc = "no"; # likely a 'thumbnail' requirement

  # dynamic-subs.lua
  programs.mpv.config.sub-auto = "all";

  #https://nixos.wiki/wiki/Accelerated_Video_Playback
  programs.mpv.config.hwdec       = "auto-safe";
  programs.mpv.config.vo          = "gpu";
  programs.mpv.config.profile     = "gpu-hq";
  programs.mpv.config.gpu-context = "wayland";
}