Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
youtube player api: Uncaught TypeError: a.next is not a function when loading script from www.youtube.com/iframe_api

the following problem: I load the player api as described here: https://developers.google.com/youtube/iframe_api_reference#Getting_Started

Then i get this error message: enter image description here

I get this error only on some domains. On other domains, it works fine. With the same video and the same iframe snippet.

unfortunately when this error occurs this callback function is never executed: onYouTubeIframeAPIReady

This is the main issue here.

If i wait a couple of seconds and execute the snippet manually:

  var tag = document.createElement('script');

  tag.src = "https://www.youtube.com/iframe_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

the error message does not appear. But onYouTubeIframeAPIReady is still not executed.

So it must be some kind of timing issue. But the problem never occurred to me before. Any hints on what might be the reason for that or easy workarounds would be appreciated.

Unfortunately, I am not allowed to share the affected domains.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!