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

269
Views
Using contentWindow.postMessage to control YouTube videos embedded in iframe--where can I find a list of "func"?

I'm new to front-end development so maybe this is a stupid question. I'm trying to write a program to control YouTube videos embedded using vanilla JavaScript. I found an example in this Control YouTube video with vanilla javascript link. I noticed the author uses contentWindow.postMessage() to send the command to the iframe.

For example, to play the YouTube video, the code is something like

div.getElementsByTagName("iframe")[0].contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');

Where can I find a complete list of "func" (e.g. "playVideo")? I googled using keywords like "postMessage", "iframe", "playVideo", etc but couldn't find any documentation that answers my question.

I want to be able to control the YouTube video more precisely. In addition to playing/pausing the video, I want to be able to skip to a certain timestamp, control the volume, or even output only the left or right sound channel.

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!