How are media plays counted in the Matomo database?

Hello All,
I am working with Matomo mysql database to present tracking data in analytics platform.
I am very confused in how to calculate “Media Plays” Number from the database so that it displays the number presented in Matomo analytics frontend in media tabs.
When I count [idviews] from matomo_log_media or [idvisits] aus matomo_log_link_visit_action the number is either bigger or smaller depending on if counted unique or not, filtering per [watch_time] bigger than 0 is also not bringing the numbers that are displayed in matomo analytics frontend media tabs. Any hints to what algrithm /fields should be used to count it properly would be most appreciated.
The only definition I could find on matomo sites " “Plays”, the number of times a visitor watched or listened to this media." is not really explaining the matter when working with Matomo databse data.I have also checked that the count of “play” Events is also different than “Plays” Count in Media Tab. I would be really grateful for some advice how to count it to get the number properly.

Hi @Morfix,

Could you please get in touch with our Support team at shop@innocraft.com.