Commit d2c0ac32 by Matjaz Gregoric Committed by GitHub

Merge pull request #13475 from open-craft/mtyaka/youtube-api-error

Don't show error in studio when fetching YouTube metadata fails.
parents ab6b23b1 c47561e1
/* eslint no-console:0 */
/** /**
* @file Initialize module works with the JSON config, and sets up various * @file Initialize module works with the JSON config, and sets up various
* settings, parameters, variables. After all setup actions are performed, it * settings, parameters, variables. After all setup actions are performed, it
...@@ -13,8 +14,8 @@ ...@@ -13,8 +14,8 @@
(function(requirejs, require, define) { (function(requirejs, require, define) {
define( define(
'video/01_initialize.js', 'video/01_initialize.js',
['video/03_video_player.js', 'video/00_i18n.js', 'moment'], ['video/03_video_player.js', 'video/00_i18n.js', 'moment', 'underscore'],
function(VideoPlayer, i18n, moment) { function(VideoPlayer, i18n, moment, _) {
var moment = moment || window.moment; var moment = moment || window.moment;
/** /**
* @function * @function
...@@ -698,7 +699,14 @@ function(VideoPlayer, i18n, moment) { ...@@ -698,7 +699,14 @@ function(VideoPlayer, i18n, moment) {
return $.ajax({ return $.ajax({
url: [this.config.ytMetadataUrl, '?id=', url, '&part=contentDetails&key=', this.config.ytKey].join(''), url: [this.config.ytMetadataUrl, '?id=', url, '&part=contentDetails&key=', this.config.ytKey].join(''),
timeout: this.config.ytTestTimeout, timeout: this.config.ytTestTimeout,
success: _.isFunction(callback) ? callback : null success: _.isFunction(callback) ? callback : null,
error: function() {
console.warn(
'YouTube API request failed - usually this means the YouTube API key is invalid. ' +
'Some video metadata may be unavailable.'
);
},
notifyOnError: false
}); });
} else { } else {
return $.Deferred().reject().promise(); return $.Deferred().reject().promise();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment