I've been digging around the Stack Overflow threads, and can't seem to find this issue addressed exactly. I set up and Angular app, and I would like to be able to call methods on a YouTube API from within multiple controllers and directives (such as playVideo()
and pauseVideo()
etc)
The video will be persistent throughout the site.
I initially set up the API via a service and subsequently injected it into the various controllers. I used a $rootscope.$broadcast
to send a message when the player was ready, but I could never get the actual player returned, just an empty object.
To make matters worse, I rebuilt the site statically so have no example code to show here, but was hoping someone might be able to outline the basic procedure here.
Thanks, James