Skip to content

Commit c1c332c

Browse files
Merge pull request #101 from asad-rafter/CLD-342-video-poster-custom-transformation
video-poster-transforamtion
2 parents 4a54632 + 9724db7 commit c1c332c

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

cartridges/int_cloudinary_pd/cartridge/experience/components/assets/mediaLibraryVideo.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ module.exports.preRender = function (context, editorId) {
193193
viewmodel.cloudName = currentSite.getCustomPreferenceValue('CloudinaryPageDesignerCloudName');
194194
viewmodel.public_id = publicId;
195195
viewmodel.id = idSafeString(randomString(16));
196+
const videoPosterTrans = 'videoPosterTransformation' in context.content ? context.content.videoPosterTransformation : currentSite.getCustomPreferenceValue('CloudinaryVideoPosterTransformations');
197+
if (videoPosterTrans) {
198+
conf.sourceConfig.poster = conf.sourceConfig.poster.replace('upload', ('upload/' + videoPosterTrans));
199+
}
196200
viewmodel.playerConf = JSON.stringify(conf);
197201
}
198202
return viewmodel;

cartridges/int_cloudinary_pd/cartridge/experience/components/assets/mediaLibraryVideo.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
"type": "cloudinary.videoForm"
1616
}
1717
},
18+
{
19+
"id": "videoPosterTransformation",
20+
"name": "Video poster transformation",
21+
"description": "Transformation for video poster.",
22+
"type": "string",
23+
"required": false
24+
},
1825
{
1926
"id": "version",
2027
"name": "Cloudinary cartridge version",
-42 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)