Talk is cheap. Show me the code.
MPV Restore Playback
Configure MPV to remember playback position when closing its window so that the playback can be resumed automatically when the video is watched the next time:
echo 'CLOSE_WIN quit_watch_later' >> ~/.config/mpv/input.conf