the soundmenuplugin (https://github.com/matiasdelellis/xfce4-soundmenu-plugin) for xfce4 allows to loop tracks via the plasma-browser-integration. Maybe you could take some inspiration/code from it and enable the same for kde.
this was implemented in plasma 5.21 beta, and it's working great! Thanks