-
Notifications
You must be signed in to change notification settings - Fork 28
feat: aspect-ratio & crop configs #996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9fd57f7
feat: aspect-ratio & crop configs
tsi dd6c9f9
feat: aspect-ratio & crop configs
tsi 808ba62
chore: separate sprite generation tx
tsi 33b3b6b
chore: breakpoint crop-mode
tsi d82e403
chore: readability
tsi b103061
fix: merge aspect-ratio ransformations
tsi 8abbe51
fix: merge aspect-ratio ransformations
tsi 6fc8ba5
chore: crop-mode enum
tsi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Cloudinary Video Player</title> | ||
| <link href="https://res.cloudinary.com/cloudinary-marketing/image/upload/f_auto,q_auto/c_scale,w_32/v1597183771/creative_staging/cloudinary_internal/Website/Brand%20Updates/Favicon/cloudinary_web_favicon_192x192.png" rel="icon" type="image/png"> | ||
|
|
||
| <!-- Bootstrap --> | ||
| <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> | ||
|
|
||
| <!-- highlight.js --> | ||
| <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-light.min.css"> | ||
| <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script> | ||
| <script>hljs.initHighlightingOnLoad();</script> | ||
|
|
||
| <script type="text/javascript" src="./scripts.js"></script> | ||
|
|
||
| <script type="text/javascript"> | ||
| window.addEventListener('load', function(){ | ||
| var player1 = cloudinary.videoPlayer('player-1', { cloudName: 'demo' }); | ||
| player1.source({ | ||
| publicId: 'sea_turtle', | ||
| aspectRatio: '1:1', | ||
| cropMode: 'fill' | ||
| }); | ||
|
|
||
| var player2 = cloudinary.videoPlayer('player-2', { cloudName: 'demo' }); | ||
| player2.source({ | ||
| publicId: 'sea_turtle', | ||
| aspectRatio: '4:3', | ||
| cropMode: 'pad', | ||
| cropPadColor: 'blue' | ||
| }); | ||
|
|
||
| var player3 = cloudinary.videoPlayer('player-3', { cloudName: 'demo' }); | ||
| player3.source({ | ||
| publicId: 'sea_turtle', | ||
| aspectRatio: '9:16', | ||
| cropMode: 'smart' | ||
| }); | ||
| }, false); | ||
| </script> | ||
|
|
||
| </head> | ||
| <body> | ||
| <div class="container p-4 col-12 col-md-9 col-xl-6"> | ||
| <nav class="nav mb-2"> | ||
| <a href="./index.html"><< Back to examples index</a> | ||
| </nav> | ||
| <h1>Cloudinary Video Player</h1> | ||
| <h3 class="mb-4">Aspect ratio & crop mode</h3> | ||
|
|
||
| <h4 class="mb-2">fill - crops to fit aspect ratio</h4> | ||
| <video | ||
| id="player-1" | ||
| playsinline | ||
| controls | ||
| muted | ||
| autoplay | ||
| class="cld-video-player" | ||
| width="500"> | ||
| </video> | ||
|
|
||
| <h4 class="mt-4 mb-2">pad - letterboxes to fit</h4> | ||
| <video | ||
| id="player-2" | ||
| playsinline | ||
| controls | ||
| muted | ||
| autoplay | ||
| class="cld-video-player" | ||
| width="500"> | ||
| </video> | ||
|
|
||
| <h4 class="mt-4 mb-2">smart with 9:16 (portrait)</h4> | ||
| <video | ||
| id="player-3" | ||
| playsinline | ||
| controls | ||
| muted | ||
| autoplay | ||
| class="cld-video-player" | ||
| width="280"> | ||
| </video> | ||
|
|
||
| <p class="mt-4"> | ||
| <a href="https://cloudinary.com/documentation/cloudinary_video_player">Full documentation</a> | ||
| </p> | ||
|
|
||
| <h3 class="mt-4">Example Code:</h3> | ||
| <pre> | ||
| <code class="language-javascript"> | ||
| // 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' | ||
| }); | ||
| </code> | ||
| </pre> | ||
| </div> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <title>Cloudinary Video Player</title> | ||
| <link | ||
| href="https://res.cloudinary.com/cloudinary-marketing/image/upload/f_auto,q_auto/c_scale,w_32,e_hue:290/creative_staging/cloudinary_internal/Website/Brand%20Updates/Favicon/cloudinary_web_favicon_192x192.png" | ||
| rel="icon" | ||
| type="image/png" | ||
| /> | ||
| <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| </head> | ||
| <body> | ||
| <div class="container p-4 col-12 col-md-9 col-xl-6"> | ||
| <nav class="nav mb-2"> | ||
| <a href="/index.html"><< Back to examples index</a> | ||
| </nav> | ||
| <h1>Cloudinary Video Player</h1> | ||
| <h3 class="mb-4">Aspect ratio & crop mode</h3> | ||
|
|
||
| <h4 class="mb-2">fill - crops to fit aspect ratio</h4> | ||
| <video | ||
| id="player-1" | ||
| playsinline | ||
| controls | ||
| muted | ||
| autoplay | ||
| class="cld-video-player" | ||
| width="500" | ||
| ></video> | ||
|
|
||
| <h4 class="mt-4 mb-2">pad - letterboxes to fit</h4> | ||
| <video | ||
| id="player-2" | ||
| playsinline | ||
| controls | ||
| muted | ||
| autoplay | ||
| class="cld-video-player" | ||
| width="500" | ||
| ></video> | ||
|
|
||
| <h4 class="mt-4 mb-2">smart with 9:16 (portrait)</h4> | ||
| <video | ||
| id="player-3" | ||
| playsinline | ||
| controls | ||
| muted | ||
| autoplay | ||
| class="cld-video-player" | ||
| width="280" | ||
| ></video> | ||
|
|
||
| <p class="mt-4"> | ||
| <a href="https://cloudinary.com/documentation/cloudinary_video_player" | ||
| >Full documentation</a | ||
| > | ||
| </p> | ||
|
|
||
| <h3 class="mt-4">Example Code:</h3> | ||
| <pre><code class="language-javascript"> | ||
| // 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' | ||
| }); | ||
| </code></pre> | ||
| </div> | ||
|
|
||
| <script type="module"> | ||
| import { videoPlayer } from 'cloudinary-video-player'; | ||
| import 'cloudinary-video-player/cld-video-player.min.css'; | ||
|
|
||
| const player1 = videoPlayer('player-1', { cloudName: 'demo' }); | ||
| player1.source({ | ||
| publicId: 'sea_turtle', | ||
| aspectRatio: '1:1', | ||
| cropMode: 'fill' | ||
| }); | ||
|
|
||
| const player2 = videoPlayer('player-2', { cloudName: 'demo' }); | ||
| player2.source({ | ||
| publicId: 'sea_turtle', | ||
| aspectRatio: '4:3', | ||
| cropMode: 'pad', | ||
| cropPadColor: 'blue' | ||
| }); | ||
|
|
||
| const player3 = videoPlayer('player-3', { cloudName: 'demo' }); | ||
| player3.source({ | ||
| publicId: 'sea_turtle', | ||
| aspectRatio: '9:16', | ||
| cropMode: 'smart' | ||
| }); | ||
| </script> | ||
|
|
||
| <link | ||
| href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" | ||
| rel="stylesheet" | ||
| integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" | ||
| crossorigin="anonymous" | ||
| /> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.