1

I have a little trouble loading the YouTube Iframe API using the !async plugin, any help appreciated!

The maps example works, so I am currently assuming the basic setup must be ok:

define('something', [
'async!http://maps.google.com/maps/api/js?sensor=false'
], function () { console.log('loaded..'); } 
);

// doesn't work
define('something', [
'async!https://www.youtube.com/iframe_api!callback'
], function () { console.log('loaded..'); } 
);

// doesn't work
define('something', [
'async!https://www.youtube.com/iframe_api!onYouTubeIframeAPIready'
], function () { console.log('loaded..'); } 
);

// doesn't work
define('something', [
'async!https://www.youtube.com/iframe_api'
], function () { console.log('loaded..'); } 
);

They all get me the Uncaught Error: Load timeout for modules: async!https://www.youtube.com/iframe_api!onload_unnormalized2,async!https://www.youtube.com/iframe_api!onload http://requirejs.org/docs/errors.html#timeout or similar (depeding on setting after the second !) which probably means the callback function onYouTubeIfraneAPIready() is never called or the !async plugin doesn't know about it.

which probably means the callback function is never called. If I defined the callback function myself it works.. but still getting the timeout error.

window.onYouTubeIframeAPIready = function () {
console.log('youtube api usual callback');
}

1 Answer 1

2

I have solved this and offered the solution back to the plugin's repository. https://github.com/millermedeiros/requirejs-plugins/pull/39

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.