How to read embed youtube iframe events

Hi can anyone help with this problem. The youtube -plugin can’t do this. I assume this would be meaningful for many developers. So there is code that works well when writing/controlling youtube iframe:


< "div id=“whateverID” style=“position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden;”>
< iframe allowfullscreen=“1” frameborder=“0” title=“YouTube video player” allow=“autoplay” wmode=“transparent” style=“position: absolute;top: 0;left: 0;width: 100%;height: 100%;” >
< /div>


callInitPlayer(func, args) {
let i = 0,
iframes = document.getElementsByTagName(‘iframe’),
src = ‘’;
// console.log('iframes: ',iframes,'func: ',func, 'args: ',args);
for (i = 0; i < iframes.length; i += 1) {
src = iframes[i].getAttribute(‘src’);
// console.log('src: ',src);
if (src && src.indexOf(‘’) !== -1) {
‘event’: ‘command’,
‘func’: func,
‘args’: args ||
}), ‘*’);

For example playing video from point 30s:
this.url =;

There are some documents about this:

I have not been able to make readings like getCurrentTime() work. jQuery gurus please help!

Just as a suggestion, you should check out the plyr package. I am currently using it to play audio files and will soon be implementing YouTube and Vimeo videos. Audio has worked great so far.

It has a currentTime property along with a timeupdate event.

That sounds very good option. Setting up the Plyr player was not very easy. I use Ionic3/type script in the current project. I need to look after solution to make it work.