Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YT.ready is not a function #136

Open
jsindos opened this issue Aug 26, 2016 · 5 comments
Open

YT.ready is not a function #136

jsindos opened this issue Aug 26, 2016 · 5 comments

Comments

@jsindos
Copy link

jsindos commented Aug 26, 2016

I'm using angular-youtube-embed in an es6 webpack angular project. I'm loading the youtube iframe API from a file youtubeapi.js, followed by import ./youtubeapi in index.js where the angular module declaration is made:

import './youtubeapi';
import angular-youtube-embed from 'angular-youtube-embed';

angular.module('videoApp', [angular-youtube-embed]);

When navigating to a page which uses videoApp, I get the error YT.ready is not a function.

On refreshing the page, the error goes away. I'm wondering how to make sure the youtube API has loaded before angular-youtube-embed directives are run?

@brandly
Copy link
Owner

brandly commented Aug 26, 2016

could you try doing import YT from './youtubeapi'?

i'm not sure what ./youtubeapi exports, since i've never loaded it with an import statement like that, but it's worth a shot 🌟

@zrichardson8039
Copy link

Is it possible YT.ready (in line 101 of angular-youtube-embed.js) should actually be YT.load? When I look at the source of youtube-iframe, it seems to have a function called "load" that accepts a callback, but not a function called "ready".

@brandly
Copy link
Owner

brandly commented Oct 27, 2016

if you check out the demo, YT is available globally on that page

screen shot 2016-10-27 at 11 00 57 am

@whiterook6
Copy link

I'm having the same problem. I don't know where YT.ready is supposed to come from. We're making a Cordova phonegap app, so we can't load external scripts from, say, youtube. I downloaded the script that www.youtube.com/iframe_api installs and am including that, but I also get the same error:

TypeError: YT.ready is not a function

When I debug and inspect the YT variable I get this:

screen shot 2017-05-02 at 3 52 31 pm

What is YT supposed to look like?

@brandly
Copy link
Owner

brandly commented May 3, 2017

take a look at the demo and type YT into the console. YT.ready is defined there.

idk much at all about cordova, but i think there's a way to whitelist domains to load external scripts.

good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants