I’m having some trouble with the Youtube API. Currently I’m simply trying to have a “play” button next to a video. I’m running the code on a local webserver (not on my hard drive) and I’ve searched multiple topics on the internet to no avail. Here’s a demo I saw on another stackoverflow topic, which should theoretically work (and it’s the code I’m trying to use currently): http://jsfiddle.net/L8qMe/1/
However, in Firefox 15 and IE on Windows 7, the play button does not work for me in the demo, so I no longer think this is a code problem. Is it a security setting maybe? Is there a way around it? Please help!
Update: neither the demo nor my webserver (running the demo’s code) works in google chrome either.
You need to add event listeners:
Check JSFiddle