diff --git a/vendor/magento/module-product-video/etc/csp_whitelist.xml b/vendor/magento/module-product-video/etc/csp_whitelist.xml index ca453605710..2e091440330 100644 --- a/vendor/magento/module-product-video/etc/csp_whitelist.xml +++ b/vendor/magento/module-product-video/etc/csp_whitelist.xml @@ -14,6 +14,7 @@ www.googleapis.com vimeo.com www.vimeo.com + *.vimeocdn.com @@ -21,5 +22,10 @@ *.vimeocdn.com + + + player.vimeo.com + + diff --git a/vendor/magento/module-product-video/i18n/en_US.csv b/vendor/magento/module-product-video/i18n/en_US.csv index debcab151cc..368a83985ba 100644 --- a/vendor/magento/module-product-video/i18n/en_US.csv +++ b/vendor/magento/module-product-video/i18n/en_US.csv @@ -41,3 +41,4 @@ Delete,Delete "Show related video","Show related video" "Auto restart video","Auto restart video" "Delete image in all store views","Delete image in all store views" +"Because of its privacy settings, this video cannot be played here.","Because of its privacy settings, this video cannot be played here." diff --git a/vendor/magento/module-product-video/view/adminhtml/web/js/get-video-information.js b/vendor/magento/module-product-video/view/adminhtml/web/js/get-video-information.js index cb56a085304..b034f796875 100644 --- a/vendor/magento/module-product-video/view/adminhtml/web/js/get-video-information.js +++ b/vendor/magento/module-product-video/view/adminhtml/web/js/get-video-information.js @@ -495,28 +495,40 @@ define([ */ function _onVimeoLoaded(data) { var tmp, - respData; + respData, + videoDescription = ''; - if (data.length < 1) { + if (!data) { this._onRequestError($.mage.__('Video not found')); return null; } - tmp = data[0]; - respData = { - duration: this._formatVimeoDuration(tmp.duration), - channel: tmp['user_name'], - channelId: tmp['user_url'], - uploaded: tmp['upload_date'], - title: tmp.title, - description: tmp.description.replace(/( |<([^>]+)>)/ig, ''), - thumbnail: tmp['thumbnail_large'], - videoId: videoInfo.id, - videoProvider: videoInfo.type - }; - this._videoInformation = respData; - this.element.trigger(this._UPDATE_VIDEO_INFORMATION_TRIGGER, respData); - this.element.trigger(this._FINISH_UPDATE_INFORMATION_TRIGGER, true); + tmp = data; + + if (tmp.description !== null) { + videoDescription = tmp.description; + } + + if (tmp.duration == null) { + this._onRequestError( + $.mage.__('Because of its privacy settings, this video cannot be played here.') + ); + } else { + respData = { + duration: this._formatVimeoDuration(tmp.duration), + channel: tmp['author_name'], + channelId: tmp['author_url'], + uploaded: tmp['upload_date'], + title: tmp.title, + description: videoDescription.replace(/( |<([^>]+)>)/ig, ''), + thumbnail: tmp['thumbnail_url'], + videoId: videoInfo.id, + videoProvider: videoInfo.type + }; + this._videoInformation = respData; + this.element.trigger(this._UPDATE_VIDEO_INFORMATION_TRIGGER, respData); + this.element.trigger(this._FINISH_UPDATE_INFORMATION_TRIGGER, true); + } } type = videoInfo.type; @@ -539,10 +551,11 @@ define([ ); } else if (type === 'vimeo') { $.ajax({ - url: 'https://www.vimeo.com/api/v2/video/' + id + '.json', + url: 'https://vimeo.com/api/oembed.json', dataType: 'jsonp', data: { - format: 'json' + format: 'json', + url: 'https://vimeo.com/' + id }, timeout: 5000, success: $.proxy(_onVimeoLoaded, self), diff --git a/lib/web/fotorama/fotorama.js b/lib/web/fotorama/fotorama.js index 314949bd2f4..f268c9aa736 100644 --- a/lib/web/fotorama/fotorama.js +++ b/lib/web/fotorama/fotorama.js @@ -858,13 +858,16 @@ fotoramaVersion = '4.6.4'; dataFrame.thumbsReady = true; } else if (video.type === 'vimeo') { $.ajax({ - url: getProtocol() + 'vimeo.com/api/v2/video/' + video.id + '.json', + url: getProtocol() + 'vimeo.com/api/oembed.json', + data: { + url: 'https://vimeo.com/' + video.id + }, dataType: 'jsonp', success: function (json) { dataFrame.thumbsReady = true; updateData(data, { - img: json[0].thumbnail_large, - thumb: json[0].thumbnail_small + img: json[0].thumbnail_url, + thumb: json[0].thumbnail_url }, dataFrame.i, fotorama); } });