-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathbreakpoints.html
More file actions
103 lines (91 loc) · 3.31 KB
/
breakpoints.html
File metadata and controls
103 lines (91 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!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" />
<style>
.video-url {
margin-top: 15px;
padding: 10px;
background: #f8f9fa;
border-radius: 5px;
word-break: break-all;
font-family: monospace;
font-size: 12px;
}
</style>
</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">Breakpoints - Responsive Video Resolution</h3>
<p>
Breakpoints automatically select the optimal video resolution based on player width and device pixel ratio (DPR).
Container width is rounded to the nearest rendition [640, 1280, 1920, 3840] and Cloudinary handles DPR scaling.
</p>
<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>
<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">
import videoPlayer from 'cloudinary-video-player/videoPlayer';
import 'cloudinary-video-player/cld-video-player.min.css';
const player = videoPlayer('player-with-breakpoints', {
cloudName: 'demo',
breakpoints: true,
dpr: 2.0
});
player.source('sea_turtle');
function updateVideoUrl() {
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;
}
player.on('loadedmetadata', updateVideoUrl);
</script>
<!-- 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"
/>
</body>
</html>