Skip to content

Commit f2231f8

Browse files
committed
MC-40463: Vimeo simple API stop working as expected
1 parent 3b860f5 commit f2231f8

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoStorefrontProductPageActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<argument name="videoType" type="string" defaultValue="youtube"/>
1818
</arguments>
1919

20+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productVideo(videoType)}}" stepKey="waitVideoElementVisible"/>
2021
<seeElement selector="{{StorefrontProductInfoMainSection.productVideo(videoType)}}" stepKey="seeProductVideoDataType"/>
2122
</actionGroup>
2223
</actionGroups>

app/code/Magento/ProductVideo/etc/csp_whitelist.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@
1414
<value id="google_video" type="host">www.googleapis.com</value>
1515
<value id="vimeo" type="host">vimeo.com</value>
1616
<value id="www_vimeo" type="host">www.vimeo.com</value>
17+
<value id="vimeo_cdn" type="host">*.vimeocdn.com</value>
1718
</values>
1819
</policy>
1920
<policy id="img-src">
2021
<values>
2122
<value id="vimeo_cdn" type="host">*.vimeocdn.com</value>
2223
</values>
2324
</policy>
25+
<policy id="frame-src">
26+
<values>
27+
<value id="player_vimeo" type="host">player.vimeo.com</value>
28+
</values>
29+
</policy>
2430
</policies>
2531
</csp_whitelist>

app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -497,20 +497,20 @@ define([
497497
var tmp,
498498
respData;
499499

500-
if (data.length < 1) {
500+
if (!data) {
501501
this._onRequestError($.mage.__('Video not found'));
502502

503503
return null;
504504
}
505-
tmp = data[0];
505+
tmp = data;
506506
respData = {
507507
duration: this._formatVimeoDuration(tmp.duration),
508-
channel: tmp['user_name'],
509-
channelId: tmp['user_url'],
508+
channel: tmp['author_name'],
509+
channelId: tmp['author_url'],
510510
uploaded: tmp['upload_date'],
511511
title: tmp.title,
512512
description: tmp.description.replace(/(&nbsp;|<([^>]+)>)/ig, ''),
513-
thumbnail: tmp['thumbnail_large'],
513+
thumbnail: tmp['thumbnail_url'],
514514
videoId: videoInfo.id,
515515
videoProvider: videoInfo.type
516516
};
@@ -539,10 +539,11 @@ define([
539539
);
540540
} else if (type === 'vimeo') {
541541
$.ajax({
542-
url: 'https://www.vimeo.com/api/v2/video/' + id + '.json',
542+
url: 'https://vimeo.com/api/oembed.json',
543543
dataType: 'jsonp',
544544
data: {
545-
format: 'json'
545+
format: 'json',
546+
url: 'https://vimeo.com/' + id
546547
},
547548
timeout: 5000,
548549
success: $.proxy(_onVimeoLoaded, self),

lib/web/fotorama/fotorama.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,13 +858,16 @@ fotoramaVersion = '4.6.4';
858858
dataFrame.thumbsReady = true;
859859
} else if (video.type === 'vimeo') {
860860
$.ajax({
861-
url: getProtocol() + 'vimeo.com/api/v2/video/' + video.id + '.json',
861+
url: getProtocol() + 'vimeo.com/api/oembed.json',
862+
data: {
863+
url: 'https://vimeo.com/' + video.id
864+
},
862865
dataType: 'jsonp',
863866
success: function (json) {
864867
dataFrame.thumbsReady = true;
865868
updateData(data, {
866-
img: json[0].thumbnail_large,
867-
thumb: json[0].thumbnail_small
869+
img: json[0].thumbnail_url,
870+
thumb: json[0].thumbnail_url
868871
}, dataFrame.i, fotorama);
869872
}
870873
});

0 commit comments

Comments
 (0)