-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathadaptive-streaming.html
More file actions
199 lines (183 loc) · 5.71 KB
/
adaptive-streaming.html
File metadata and controls
199 lines (183 loc) · 5.71 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!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" />
<script src="https://cdn.jsdelivr.net/npm/ua-parser-js@0.7.20/src/ua-parser.min.js"></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">Adaptive streaming</h3>
<div class="video-container mb-4">
<h4>HLS 264</h4>
<video
id="example-player-hls"
playsinline
controls
muted
width="500"
class="cld-video-player"
></video>
<p id="info-hls" class="info"></p>
</div>
<div class="video-container mb-4">
<h4>HLS 265</h4>
<video
id="example-player-hls-h265"
controls
muted
width="500"
class="cld-video-player">
</video>
<p id="info-hls-h265" class="info"></p>
</div>
<div class="video-container mb-4">
<h4>MPEG-DASH h264</h4>
<video
id="example-player-dash"
playsinline
controls
muted
width="500"
class="cld-video-player">
</video>
<p id="info-dash" class="info"></p>
</div>
<div class="video-container mb-4">
<h4>MPEG-DASH vp9</h4>
<video
id="example-player-dash-vp9"
playsinline
controls
muted
width="500"
class="cld-video-player">
</video>
<p id="info-dash-vp9" class="info"></p>
</div>
<div class="video-container mb-4">
<h4>HLS with fastStart</h4>
<video
id="example-player-fast-start"
playsinline
controls
muted
width="500"
class="cld-video-player">
</video>
<p id="info-fast-start" class="info"></p>
</div>
<div class="video-container mb-4">
<h4>HLS with highQuality</h4>
<video
id="example-player-high-quality"
playsinline
controls
muted
width="500"
class="cld-video-player">
</video>
<p id="info-high-quality" class="info"></p>
</div>
<p class="mt-4">
<a href="https://cloudinary.com/documentation/cloudinary_video_player"
>Full documentation</a
>
</p>
</div>
<script type="module">
import { videoPlayer } from 'cloudinary-video-player';
import 'cloudinary-video-player/cld-video-player.min.css';
const cldConfig = {
cloud_name: 'demo',
secure: true,
debug: true
};
const uap = new UAParser(navigator.userAgent);
const playerHls = videoPlayer('example-player-hls', cldConfig);
const playerHlsH265 = videoPlayer('example-player-hls-h265', cldConfig);
const playerDash = videoPlayer('example-player-dash', cldConfig);
const playerDashVp9 = videoPlayer('example-player-dash-vp9', cldConfig);
const playerFastStart = videoPlayer('example-player-fast-start', cldConfig);
const playerHighQuality = videoPlayer('example-player-high-quality', cldConfig);
playerHls.source(
'sea_turtle',
{
sourceTypes: ['hls'],
info: {title: 'HLS /w sp_auto'}
}
);
playerHlsH265.source(
'sea_turtle',
{
sourceTypes: ['hls/h265'],
transformation: {streaming_profile: 'full_hd_h265'},
info: {title: 'HLS 265'}
}
);
playerDash.source(
'sea_turtle',
{
sourceTypes: ['dash/h264'],
transformation: {streaming_profile: 'hd'},
info: {title: 'MPEG-DASH'}
}
);
playerDashVp9.source(
'sea_turtle',
{
sourceTypes: ['dash/vp9'],
transformation: {streaming_profile: 'full_hd_vp9'},
info: {title: 'MPEG-DASH vp9'}
}
);
playerFastStart.source(
'sea_turtle',
{
sourceTypes: ['hls'],
info: {title: 'HLS /w fastStart'},
adaptiveStreaming: {
strategy: 'fastStart'
}
}
);
playerHighQuality.source(
'sea_turtle',
{
sourceTypes: ['hls'],
info: {title: 'HLS /w fastStart'},
adaptiveStreaming: {
strategy: 'highQuality'
}
}
);
[playerHls, playerHlsH265, playerDash, playerDashVp9, playerFastStart, playerHighQuality].forEach(player => {
player.on('qualitychanged', function(data) {
console.log(player.options.videojsOptions.id + ' qualitychanged', data);
});
player.on('playing', function(data) {
const info = player.videoElement.parentElement.parentElement.querySelector('.info');
info.innerHTML = uap.getBrowser().name + ' is playing ' + player.videojs.currentSrc();
});
});
</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>