Media analytics plugin with dynamically created html5 and youtube players

i’m understanding and using the matomo media analytics plugin with static html5 video players. “static” is meant here as they’re present in the DOM after the page has loaded and they’re catched by the MA plugin media scan after page load.

my problem is to let the MA plugin know about instances of html5 and youtube video players dynamically created by javascript in the users browser independently of any page load. in fact i’ve an index.html which is never reloaded during a user session.

i’ve studied this from the dev guide:
https://developer.matomo.org/guides/media-analytics/options
and found something maybe useful in the youtube api:

but i’m not getting the big picture yet…

does anybody here has implemeted the MA plugin this way? i can imagine there a similar approach needed when it comes to dynamic frontends like react, angular or vue.
any inputs, hints to ressources etc. are highly appreciated!

Thanks a lot for listening!