-
Notifications
You must be signed in to change notification settings - Fork 28
feat: better error message for 423 (processing) #999
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
Changes from all commits
ddfe103
6a8a681
716bcfd
d1377be
711ac11
653a914
269f1fb
5e5787c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,23 +17,28 @@ | |
|
|
||
| <script type="text/javascript"> | ||
| window.addEventListener('load', function(){ | ||
| var player1 = cloudinary.videoPlayer('player-1', { cloudName: 'demo' }); | ||
| player1.source({ | ||
| var player1 = cloudinary.videoPlayer('player-1', { | ||
| cloudName: 'demo', | ||
| publicId: 'sea_turtle', | ||
| aspectRatio: '1:1', | ||
| cropMode: 'fill' | ||
| cropMode: 'fill', | ||
| breakpoints: true, | ||
| transformation: [ | ||
| { effect: 'blur:500' }, | ||
| { effect: 'saturation:-100' } | ||
| ] | ||
|
Comment on lines
+26
to
+29
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And added a custom transformation to see how they are being merged |
||
| }); | ||
|
|
||
| var player2 = cloudinary.videoPlayer('player-2', { cloudName: 'demo' }); | ||
| player2.source({ | ||
| var player2 = cloudinary.videoPlayer('player-2', { | ||
| cloudName: 'demo', | ||
| publicId: 'sea_turtle', | ||
| aspectRatio: '4:3', | ||
| cropMode: 'pad', | ||
| cropPadColor: 'blue' | ||
| }); | ||
|
|
||
| var player3 = cloudinary.videoPlayer('player-3', { cloudName: 'demo' }); | ||
| player3.source({ | ||
| var player3 = cloudinary.videoPlayer('player-3', { | ||
| cloudName: 'demo', | ||
| publicId: 'sea_turtle', | ||
| aspectRatio: '9:16', | ||
| cropMode: 'smart' | ||
|
|
@@ -55,8 +60,6 @@ <h4 class="mb-2">fill - crops to fit aspect ratio</h4> | |
| id="player-1" | ||
| playsinline | ||
| controls | ||
| muted | ||
| autoplay | ||
|
Comment on lines
-58
to
-59
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we can see the poater |
||
| class="cld-video-player" | ||
| width="500"> | ||
| </video> | ||
|
|
@@ -66,8 +69,6 @@ <h4 class="mt-4 mb-2">pad - letterboxes to fit</h4> | |
| id="player-2" | ||
| playsinline | ||
| controls | ||
| muted | ||
| autoplay | ||
| class="cld-video-player" | ||
| width="500"> | ||
| </video> | ||
|
|
@@ -77,8 +78,6 @@ <h4 class="mt-4 mb-2">smart with 9:16 (portrait)</h4> | |
| id="player-3" | ||
| playsinline | ||
| controls | ||
| muted | ||
| autoplay | ||
| class="cld-video-player" | ||
| width="280"> | ||
| </video> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <title>Breakpoints - Cloudinary Video Player</title> | ||
| <title>Cloudinary Video Player</title> | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I asked cursor to align the |
||
| <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" | ||
|
|
@@ -11,9 +11,6 @@ | |
| <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <style> | ||
| .player-container { | ||
| margin-bottom: 30px; | ||
| } | ||
| .video-url { | ||
| margin-top: 15px; | ||
| padding: 10px; | ||
|
|
@@ -38,34 +35,33 @@ <h3 class="mb-4">Breakpoints - Responsive Video Resolution</h3> | |
| Container width is rounded to the nearest rendition [640, 1280, 1920, 3840] and Cloudinary handles DPR scaling. | ||
| </p> | ||
|
|
||
| <div class="player-container"> | ||
| <h4 class="mt-4">Breakpoints Example (DPR 2.0)</h4> | ||
| <video | ||
| id="player-with-breakpoints" | ||
| class="cld-video-player" | ||
| controls | ||
| muted | ||
| width="500" | ||
| ></video> | ||
| <video | ||
| id="player-with-breakpoints" | ||
| class="cld-video-player cld-fluid" | ||
| crossorigin="anonymous" | ||
| controls | ||
| muted | ||
| playsinline | ||
| width="500" | ||
| ></video> | ||
|
|
||
| <div class="video-url"> | ||
| <strong>Video URL:</strong><br> | ||
| <span id="video-url">Loading...</span> | ||
| </div> | ||
| <div class="video-url"> | ||
| <strong>Video URL:</strong><br> | ||
| <span id="video-url">Loading...</span> | ||
| </div> | ||
|
|
||
| <h4 class="mt-4">Configuration</h4> | ||
| <ul> | ||
| <li><code>breakpoints</code> (boolean): Enable/disable breakpoints</li> | ||
| <li><code>dpr</code> (number): Device pixel ratio - 1.0, 1.5, or 2.0 (default: 2.0)</li> | ||
| <li><strong>Renditions:</strong> [640, 1280, 1920, 3840]</li> | ||
| </ul> | ||
|
|
||
| <p class="mt-4"> | ||
| <a href="https://cloudinary.com/documentation/cloudinary_video_player" | ||
| >Full documentation</a | ||
| > | ||
| </p> | ||
|
|
||
| <h3 class="mt-4">Configuration Options</h3> | ||
| <ul> | ||
| <li><code>breakpoints</code> (boolean): Enable/disable breakpoints</li> | ||
| <li><code>dpr</code> (number): Device pixel ratio - 1.0, 1.5, or 2.0 (default: 2.0)</li> | ||
| <li><strong>Renditions:</strong> [640, 1280, 1920, 3840] - Container width is rounded to nearest value</li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <script type="module"> | ||
|
|
@@ -79,23 +75,20 @@ <h4 class="mt-4">Configuration</h4> | |
| }); | ||
| player.source('sea_turtle'); | ||
|
|
||
| // Display video URL using multiple methods | ||
| function updateVideoUrl() { | ||
| // Try getting from video element | ||
| const videoElement = player.videojs?.el()?.querySelector('video') || | ||
| const videoElement = player.videojs?.el()?.querySelector('video') || | ||
| document.querySelector('#player-with-breakpoints video') || | ||
| document.querySelector('.vjs-tech'); | ||
|
|
||
| const src = videoElement?.currentSrc || videoElement?.src || ''; | ||
|
|
||
| if (src) { | ||
| document.getElementById('video-url').textContent = src; | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| // Update URL when video source is loaded | ||
| player.on('loadedmetadata', updateVideoUrl); | ||
| </script> | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import videojs from 'video.js'; | ||
| import { PLAYER_EVENT } from 'utils/consts'; | ||
|
|
||
| const ErrorDisplay = videojs.getComponent('ErrorDisplay'); | ||
|
|
||
| class CldErrorDisplay extends ErrorDisplay { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Custom error display component to 1. allow html link and 2. handle the refresh click |
||
| content() { | ||
| const error = this.player().error(); | ||
| if (!error) return ''; | ||
|
|
||
| const wrapper = videojs.dom.createEl('div', { className: 'cld-error-display-content' }); | ||
| const msg = videojs.dom.createEl('span', { className: 'cld-error-message' }); | ||
| if (error.isHtml) { | ||
| msg.innerHTML = this.localize(error.message); | ||
| } else { | ||
| msg.textContent = this.localize(error.message); | ||
| } | ||
| wrapper.appendChild(msg); | ||
|
|
||
| const refreshLink = msg.querySelector('.cld-error-refresh'); | ||
| if (refreshLink) { | ||
| refreshLink.onclick = (e) => { | ||
| e.preventDefault(); | ||
| this.player().trigger(PLAYER_EVENT.REFRESH); | ||
| }; | ||
| } | ||
| return wrapper; | ||
| } | ||
| } | ||
|
|
||
| export default CldErrorDisplay; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better testing of our VS videojs
aspectRatiohandling, I changed it to be called inplayer()