Anki does not play audio and show error "Sound and video on cards will not function until mpv or mplayer is installed."

You need to install mplayer in your computer using these commands in the terminal:

sudo add-apt-repository universe
sudo apt update
sudo apt install mplayer mplayer-gui

After that restart your Anki. It worked for me.

Source for installing mplayer manually


Change the line 107 in your file /usr/share/anki/anki/mpv.py from

        self.argv += ["--input-ipc-server", self._sock_filename]

to

        self.argv += ["--input-ipc-server=" + self._sock_filename]

as in the fixed upstream.

You'd better add the file /usr/share/anki/anki/mpv.py to local diversions lest it be overwritten by any unfixed "update". If you don't know what local diversion is, just man dpkg-divert.

dpkg-divert  --divert /usr/share/anki/anki/mpv.py~ --no-rename --add /usr/share/anki/anki/mpv.py