-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathcloudinary-analytics.html
More file actions
233 lines (200 loc) · 6.64 KB
/
cloudinary-analytics.html
File metadata and controls
233 lines (200 loc) · 6.64 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!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>
<!--
We're loading scripts & style dynamically for development/testing.
Real-world usage would look like this:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/cloudinary-video-player/dist/player.min.css">
<script src="https://cdn.jsdelivr.net/npm/cloudinary-video-player/dist/player.min.js"></script>
-->
<script type="text/javascript" src="./scripts.js"></script>
<script type="text/javascript">
window.addEventListener('load', () => {
const player = cloudinary.videoPlayer('player', {
cloudName: 'demo',
secure: true,
cloudinaryAnalytics: true
});
player.source('elephants');
const adpPlayer = cloudinary.videoPlayer('adpPlayer', {
cloudName: 'demo',
secure: true,
cloudinaryAnalytics: true
});
adpPlayer.source('https://res.cloudinary.com/demo/video/upload/sp_hd/sea_turtle.mpd');
const playerCustomDataPlainObject = cloudinary.videoPlayer('player-custom-data-plain-object', {
cloudName: 'demo',
secure: true,
cloudinaryAnalytics: {
customData: {
customData1: 'my-value',
customData2: '11111',
customData3: 'custom-data-3-value',
customData4: 'Hello world',
customData5: 'false',
},
},
});
playerCustomDataPlainObject.source('elephants');
const playerCustomDataFunction = cloudinary.videoPlayer('player-custom-data-function', {
cloudName: 'demo',
secure: true,
cloudinaryAnalytics: {
customData: () => ({
customData1: 'my-value',
customData3: '11111',
}),
},
});
playerCustomDataFunction.source('elephants');
}, 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">Cloudinary analytics</h3>
<video
id="player"
playsinline
controls
muted
autoplay
class="cld-video-player"
width="500"
></video>
<br><br><br>
<video
id="adpPlayer"
playsinline
controls
muted
autoplay
class="cld-video-player"
width="500"
></video>
<h3 class="mt-4">Example Code:</h3>
<pre>
<code class="language-html">
<video
id="player"
controls
muted
autoplay
class="cld-video-player"
width="500">
</video>
</code>
<code class="language-javascript">
<script type="text/javascript">
const player = cloudinary.videoPlayer('player', {
cloudName: 'demo',
secure: true,
cloudinaryAnalytics: true
});
player.source('elephants');
const adpPlayer = cloudinary.videoPlayer('adpPlayer', {
cloudName: 'demo',
secure: true,
cloudinaryAnalytics: true
});
adpPlayer.source('https://res.cloudinary.com/demo/video/upload/sp_hd/sea_turtle.mpd');
</script>
</code>
</pre>
<h3 class="mb-4">Cloudinary analytics with custom data - plain object</h3>
<p>Only those 5 params are supported & value needs to be string - otherwise it will be filtered out.</p>
<video
id="player-custom-data-plain-object"
playsinline
controls
muted
autoplay
class="cld-video-player"
width="500"
></video>
<h3 class="mt-4">Example Code:</h3>
<pre>
<code class="language-html">
<video
id="player-custom-data-plain-object"
controls
muted
autoplay
class="cld-video-player"
width="500">
</video>
</code>
<code class="language-javascript">
<script type="text/javascript">
const playerCustomDataPlainObject = cloudinary.videoPlayer('player-custom-data-plain-object', {
cloudName: 'demo',
secure: true,
cloudinaryAnalytics: {
customData: {
customData1: 'my-value',
customData2: '11111',
customData3: 'custom-data-3-value',
customData4: 'Hello world',
customData5: 'false',
},
},
});
playerCustomDataPlainObject.source('elephants');
</script>
</code>
</pre>
<h3 class="mb-4">Cloudinary analytics with custom data - function</h3>
<p>If you need to provide custom data with some dynamic values - you can use function that returns object with supported keys.</p>
<video
id="player-custom-data-function"
playsinline
controls
muted
autoplay
class="cld-video-player"
width="500"
></video>
<h3 class="mt-4">Example Code:</h3>
<pre>
<code class="language-html">
<video
id="player-custom-data-function"
controls
muted
autoplay
class="cld-video-player"
width="500">
</video>
</code>
<code class="language-javascript">
<script type="text/javascript">
const playerCustomDataFunction = cloudinary.videoPlayer('player-custom-data-function', {
cloudName: 'demo',
secure: true,
cloudinaryAnalytics: {
customData: () => ({
customData1: 'my-value',
customData3: '11111',
}),
},
});
playerCustomDataFunction.source('elephants');
</script>
</code>
</pre>
</div>
</body>
</html>