Skip to content

Commit 39cb18d

Browse files
Merge pull request #71 from asad-rafter/CLD-280-video-player-links
Enhance the web performance of the video player
2 parents d9575e9 + 193f263 commit 39cb18d

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

cartridges/int_cloudinary/cartridge/scripts/model/cloudinaryModel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ var getCloudinaryVideo = function (productID, currentLocale) {
251251
posterTransformation.push({
252252
raw_transformation: videoPosterTransforamtion
253253
})
254-
widgetOptions.posterOptions = { transformation: posterTrans };
254+
widgetOptions.posterOptions = { transformation: posterTransformation };
255255
}
256256
}
257257

cartridges/int_cloudinary/cartridge/templates/default/content/renderContentVideo.isml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
A general template to render cloudinary video player
33
for content assets and other static pages.
44
</iscomment>
5+
56
<isset name="cloudinaryStaticContent" value="${pdict.cloudinaryStaticContent}" scope="page"/>
67
<isif condition="${cloudinaryStaticContent.isEnabled && cloudinaryStaticContent.video.videoURL && cloudinaryStaticContent.video.videoURL !== '' && cloudinaryStaticContent.video.videoURL !== 'null'}">
78
<isif condition="${cloudinaryStaticContent.videoEnabled && cloudinaryStaticContent.videoPlayerEnabled}">
89
<isset name="preferences" value="${dw.system.Site.current.preferences.custom}" scope="page"/>
910
<link href="${preferences.CLDVideoPlayerCSSURL}" rel="stylesheet"/>
10-
<script src="${preferences.CLDVideoPlayerJSURL}"></script>
11+
<script defer="defer" src="${preferences.CLDVideoPlayerJSURL}" onload="window.cldVideoPlayer = cloudinary.Cloudinary;"></script>
1112

1213
<isset name="randomNumber" value="${cloudinaryStaticContent.randomNumber}" scope="page" />
1314
<video id="cld-video-player-${randomNumber}" class="cld-video-player cloudinary-data-container"
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<isif condition="${pdict.cloudinary.isEnabled && pdict.cloudinary.videoEnabled && pdict.cloudinary.videoPlayerEnabled &&
22
pdict.cloudinary.video && pdict.cloudinary.video.videoURL && pdict.cloudinary.video.videoURL !== 'null' &&
33
pdict.cloudinary.video.videoURL !== ''}">
4+
<isset name="cloudinaryConstants" value="${require('*/cartridge/scripts/util/cloudinaryConstants')}" scope="page" />
5+
<link href="${dw.system.Site.current.preferences.custom.CLDVideoPlayerCSSURL}" rel="stylesheet"/>
6+
<script defer="defer" src="${dw.system.Site.current.preferences.custom.CLDVideoPlayerJSURL}" onload="window.cldVideoPlayer = cloudinary.Cloudinary;"></script>
47
<div class="primary-videos col-12 col-sm-6">
58
<div id='pdp-video-<isprint value="${cldProductID}">'>
6-
<video id="cld-video-player" class="cld-video-player"></video>
9+
<video id="cld-video-player" class="cld-video-player" data-cloudinary="${JSON.stringify(pdict.cloudinary.video.widgetOptions)}"></video>
710
</div>
811
</div>
912
</isif>

cartridges/int_cloudinary/cartridge/templates/default/include/cloudinaryStaticLibs.isml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
<link rel="preconnect" href="${'https://' + cloudinaryConstants.CLD_GALLERY_JS_URL_DOMAIN}" />
1818
</isif>
1919
<script src="${URLUtils.staticURL('/js/cloudinaryWidgets.js')}"></script>
20-
<isif condition="${preferences.CLDVideoEnabled && preferences.CLDVideoPlayerEnabled}">
21-
<link href="${preferences.CLDVideoPlayerCSSURL}" rel="stylesheet"/>
22-
<script src="${preferences.CLDVideoPlayerJSURL}"></script>
23-
<script>
24-
window.cldVideoPlayer = cloudinary.Cloudinary;
25-
</script>
26-
</isif>
2720
<isif condition="${(CLDImagePageTypeSettings.miniCart.enabled && CLDImagePageTypeSettings.miniCart.automateResponsivenessWithJS) || (CLDImagePageTypeSettings.searchSuggestions.enabled && CLDImagePageTypeSettings.searchSuggestions.automateResponsivenessWithJS)}">
2821
<isinclude template="include/cloudinaryShrinkwrap"/>
2922
</isif>

0 commit comments

Comments
 (0)