Youtube Javascript API code outside jQuery ready function: http://jsbin.com/umituf/1
Inside jQuery ready function: http://jsbin.com/umituf/2
I would like to use jQuery because when the video is stopped (even === 0) and loadmore() method is called, I want to write a ajax call in jQuery to go back to the server and fetch more video id’s so they can be further passed to the cuePlaylist(...) method.
Why am I not able to mix jQuery and the API and How can it be done?
The functions need to be defined in the global scope.
http://jsbin.com/umituf/3
Edit for clarification:
The youtube api script looks for those particular functions on the global scope. The api script does not have access to the scope that is created within the document.ready callback.