From 9fd57f74f9ef676343c7b3a374ef1eacfee567a7 Mon Sep 17 00:00:00 2001 From: Tsachi Shlidor Date: Sun, 8 Mar 2026 18:36:36 +0200 Subject: [PATCH 1/8] feat: aspect-ratio & crop configs --- docs/aspect-ratio-crop.html | 118 +++++++++++++++++ docs/audio.html | 2 +- docs/es-modules/aspect-ratio-crop.html | 121 ++++++++++++++++++ docs/es-modules/index.html | 1 + docs/index.html | 1 + src/config/configSchema.json | 13 ++ src/plugins/cloudinary/index.js | 20 +++ src/utils/get-analytics-player-options.js | 3 + src/validators/validators.js | 3 + src/video-player.const.js | 3 + .../specs/ESM/esmAspectRatioCropPage.spec.ts | 16 +++ .../ESM/linksConsoleErrorsEsmPage.spec.ts | 2 +- .../specs/NonESM/aspectRatioCropPage.spec.ts | 10 ++ .../e2e/specs/NonESM/linksConsolErros.spec.ts | 2 +- .../aspectRatioCropPageVideoPlaying.ts | 21 +++ test/e2e/src/pom/PageManager.ts | 5 + test/e2e/src/pom/aspectRatioCropPage.ts | 17 +++ test/e2e/testData/ExampleLinkNames.ts | 1 + test/e2e/testData/esmPageLinksData.ts | 1 + test/e2e/testData/pageLinksData.ts | 1 + test/unit/videoSource.test.js | 16 +++ 21 files changed, 374 insertions(+), 3 deletions(-) create mode 100644 docs/aspect-ratio-crop.html create mode 100644 docs/es-modules/aspect-ratio-crop.html create mode 100644 test/e2e/specs/ESM/esmAspectRatioCropPage.spec.ts create mode 100644 test/e2e/specs/NonESM/aspectRatioCropPage.spec.ts create mode 100644 test/e2e/specs/commonSpecs/aspectRatioCropPageVideoPlaying.ts create mode 100644 test/e2e/src/pom/aspectRatioCropPage.ts diff --git a/docs/aspect-ratio-crop.html b/docs/aspect-ratio-crop.html new file mode 100644 index 000000000..485bb08ad --- /dev/null +++ b/docs/aspect-ratio-crop.html @@ -0,0 +1,118 @@ + + + + + Cloudinary Video Player + + + + + + + + + + + + + + + + +
+ +

Cloudinary Video Player

+

Aspect ratio & crop mode

+ +

fill - crops to fit aspect ratio

+ + +

pad - letterboxes to fit

+ + +

smart with 9:16 (portrait)

+ + +

+ Full documentation +

+ +

Example Code:

+
+      
+// Fill - crops to fit aspect ratio (no distortion)
+player.source({
+  publicId: 'sea_turtle',
+  aspectRatio: '1:1',
+  cropMode: 'fill'
+});
+
+// Pad - letterboxes to fit (no distortion)
+player.source({
+  publicId: 'sea_turtle',
+  aspectRatio: '4:3',
+  cropMode: 'pad',
+  cropPadColor: 'blue'
+});
+
+// Portrait (9:16) - smart crop
+player.source({
+  publicId: 'sea_turtle',
+  aspectRatio: '9:16',
+  cropMode: 'smart'
+});
+      
+    
+
+ + diff --git a/docs/audio.html b/docs/audio.html index f1f72de10..98238bcd0 100644 --- a/docs/audio.html +++ b/docs/audio.html @@ -71,7 +71,7 @@

Audio Player - with transformations

id="player-t" playsinline controls - class="cld-video-player" + class="cld-video-player cld-video-player-skin-light" width="500" > diff --git a/docs/es-modules/aspect-ratio-crop.html b/docs/es-modules/aspect-ratio-crop.html new file mode 100644 index 000000000..b6cb5c34d --- /dev/null +++ b/docs/es-modules/aspect-ratio-crop.html @@ -0,0 +1,121 @@ + + + + + Cloudinary Video Player + + + + + +
+ +

Cloudinary Video Player

+

Aspect ratio & crop mode

+ +

fill - crops to fit aspect ratio

+ + +

pad - letterboxes to fit

+ + +

smart with 9:16 (portrait)

+ + +

+ Full documentation +

+ +

Example Code:

+

+// Fill - crops to fit aspect ratio
+player.source({
+  publicId: 'sea_turtle',
+  aspectRatio: '1:1',
+  cropMode: 'fill'
+});
+
+// Pad - letterboxes to fit
+player.source({
+  publicId: 'sea_turtle',
+  aspectRatio: '4:3',
+  cropMode: 'pad',
+  cropPadColor: 'blue'
+});
+
+// Portrait (9:16) - smart crop
+player.source({
+  publicId: 'sea_turtle',
+  aspectRatio: '9:16',
+  cropMode: 'smart'
+});
+      
+
+ + + + + + diff --git a/docs/es-modules/index.html b/docs/es-modules/index.html index a027813b1..c7d438175 100644 --- a/docs/es-modules/index.html +++ b/docs/es-modules/index.html @@ -45,6 +45,7 @@

Code examples: