/** * You may need to wait until YT player is ready like so: */ YT.ready(function() { player = new YT.Player("some_id", {... });