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

302
Views
JS YouTube iframe API: Uncaught TypeError: player.loadVideoByUrl is not a function
let youtubeAPITag = document.createElement("script");

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

let ready = false;
let player;

window.onYouTubeIframeAPIReady = () => {
    player = new YT.Player("test", {
        width: 1920,
        height: 1080,
        videoId: "M7lc1UVf-VE"
    });
    player.loadVideoByUrl("https://youtube.com/watch?v=dQw4w9WgXcQ");
    console.log(player);
};

Error Showing

loadVideoById doesn't also work. By using console.log(player), it is sure that the player is loaded. Is there any way to solve this?

JSFiddle

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!