I'm learning how to create Chrome extensions. I just started developing one to catch YouTube events. I want to use it with YouTube flash player (later I will try to make it compatible with HTML5).
manifest.json:
{"name": "MyExtension","version": "1.0","description": "Gotta catch Youtube events!","permissions": ["tabs", "http://*/*"],"content_scripts" : [{"matches" : [ "www.youtube.com/*"],"js" : ["myScript.js"] }]}
myScript.js:
function state() { console.log("State Changed!"); }var player = document.getElementById("movie_player");player.addEventListener("onStateChange", "state");console.log("Started!");
The problem is that the console gives me the "Started!", but there is no "State Changed!" when I play/pause YouTube videos.
When this code is put in the console, it worked. What am I doing wrong?