Tried to read how it works in Gaia Music player, but didn't succeed to port it to my app, while no errors happened. Also I didn't found any relevant information about this, Gaia project uses a lot of undocumented things which sometimes are not obvious at all.
So, I need simple widget in notification area with title, artist, cover and prev/play-pause/next buttons. Just like in default music app.
Unfortunately the widget is hardcoded in the system application.
A patch is in the works to let others create widgets on the lockscreen but it has not been landed yet, and doesn't seem to land anytime soon.