YouTube iFrame-JavaScript API

RESPONSIVE. Default size: 854px x 480px

See "page source" to observe the coding in this.

Added some things from the example at

Events Capture


Oct 29, 2014: Few times, you'll notice this error on Chrome console:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('') does not match the recipient window's origin ('this_window_url')

It's filed there:
Update Feb 3, 2017: It's related to multiple devices casting (like wizard casting gardiumleviosa to bunch of things) plugin. Chrome has that feature, and YouTube player (HTML5) uses that by default. I haven't read the very detail, but the plugin isn't built-in, you need to add it manually to Chrome. Maybe. Gardiumleviosa, everybody.
You might be interested in these:
  • YouTube iframe API: how do I control a iframe player that's already in the HTML?
  • Force HTML5 video for embedded YouTube video: