cloudinary-video-player 1.6.2-edge.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +4 -0
- package/.snyk +19 -0
- package/.travis.yml +8 -0
- package/CHANGELOG.md +329 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/dist/cld-video-player.css +2110 -0
- package/dist/cld-video-player.js +5249 -0
- package/dist/cld-video-player.light.css +1766 -0
- package/dist/cld-video-player.light.js +1399 -0
- package/dist/cld-video-player.light.min.css +1 -0
- package/dist/cld-video-player.light.min.js +2 -0
- package/dist/cld-video-player.light.min.js.LICENSE.txt +23 -0
- package/dist/cld-video-player.min.css +1 -0
- package/dist/cld-video-player.min.js +2 -0
- package/dist/cld-video-player.min.js.LICENSE.txt +26 -0
- package/dist/fonts/cloudinary_icon_for_black_bg.svg +69 -0
- package/dist/fonts/cloudinary_icon_for_white_bg.svg +69 -0
- package/docs/360.html +102 -0
- package/docs/_template.html +93 -0
- package/docs/adaptive-streaming.html +297 -0
- package/docs/analytics.html +140 -0
- package/docs/api.html +302 -0
- package/docs/audio.html +136 -0
- package/docs/autoplay-fallback.html +138 -0
- package/docs/autoplay-on-scroll.html +107 -0
- package/docs/codec-fallback.html +158 -0
- package/docs/colors.html +135 -0
- package/docs/components.html +284 -0
- package/docs/custom-cld-errors.html +134 -0
- package/docs/floating-player.html +98 -0
- package/docs/fluid.html +117 -0
- package/docs/force-hls-subtitles-ios.html +159 -0
- package/docs/index.html +83 -0
- package/docs/interaction-area.html +398 -0
- package/docs/live-customer.html +128 -0
- package/docs/multiple-players.html +125 -0
- package/docs/playlist-by-tag-cap.html +182 -0
- package/docs/playlist-by-tag.html +133 -0
- package/docs/playlist.html +133 -0
- package/docs/poster.html +155 -0
- package/docs/raw-url.html +104 -0
- package/docs/recommendations.html +155 -0
- package/docs/scripts.js +156 -0
- package/docs/seek-thumbs.html +90 -0
- package/docs/shoppable.html +335 -0
- package/docs/subtitles-and-captions.html +267 -0
- package/docs/transformations.html +171 -0
- package/docs/ui-config.html +108 -0
- package/docs/vast-vpaid.html +149 -0
- package/env.example.js +6 -0
- package/env.js +6 -0
- package/jest-puppeteer.config.js +14 -0
- package/jest.config.js +196 -0
- package/package.json +99 -0
- package/sandbox.config.json +3 -0
- package/setupJest.js +1 -0
- package/src/assets/fonts/VideoJS.svg +120 -0
- package/src/assets/fonts/VideoJS.ttf +0 -0
- package/src/assets/fonts/VideoJS.woff +0 -0
- package/src/assets/fonts/icons.json +120 -0
- package/src/assets/icons/cloudinary_icon_for_black_bg.svg +69 -0
- package/src/assets/icons/cloudinary_icon_for_white_bg.svg +69 -0
- package/src/assets/icons/cloudinary_logo_for_dark_bg.svg +188 -0
- package/src/assets/icons/cloudinary_logo_for_white_bg.svg +188 -0
- package/src/assets/icons/info-circle.svg +17 -0
- package/src/assets/styles/ads-label.scss +16 -0
- package/src/assets/styles/components/interaction-areas.scss +158 -0
- package/src/assets/styles/components/playlist.scss +213 -0
- package/src/assets/styles/components/themedButton.scss +48 -0
- package/src/assets/styles/components/thumbnail.scss +94 -0
- package/src/assets/styles/components/title-bar.scss +67 -0
- package/src/assets/styles/components/triangle-volume-bar.scss +52 -0
- package/src/assets/styles/icons.scss +257 -0
- package/src/assets/styles/main.scss +324 -0
- package/src/assets/styles/mixins/aspect-ratio.scss +16 -0
- package/src/assets/styles/mixins/disable-transition.scss +3 -0
- package/src/assets/styles/mixins/mixins.scss +5 -0
- package/src/assets/styles/mixins/skin.scss +64 -0
- package/src/assets/styles/variables.scss +2 -0
- package/src/assets/styles/videojs-ima.scss +252 -0
- package/src/components/component-utils.js +20 -0
- package/src/components/index.js +21 -0
- package/src/components/interaction-area/interaction-area.const.js +30 -0
- package/src/components/interaction-area/interaction-area.service.js +223 -0
- package/src/components/interaction-area/interaction-area.utils.js +236 -0
- package/src/components/jumpButtons/jump-10-minus.js +21 -0
- package/src/components/jumpButtons/jump-10-plus.js +20 -0
- package/src/components/logoButton/logo-button.const.js +3 -0
- package/src/components/logoButton/logo-button.js +30 -0
- package/src/components/logoButton/logo-button.scss +15 -0
- package/src/components/playlist/components/playlist-button.js +34 -0
- package/src/components/playlist/components/playlist-next-button.js +18 -0
- package/src/components/playlist/components/playlist-previous-button.js +18 -0
- package/src/components/playlist/components/playlist.js +5 -0
- package/src/components/playlist/components/playlist.scss +15 -0
- package/src/components/playlist/components/upcoming-video-overlay.js +149 -0
- package/src/components/playlist/components/upcoming-video-overlay.scss +86 -0
- package/src/components/playlist/layout/playlist-layout-custom.js +21 -0
- package/src/components/playlist/layout/playlist-layout-horizontal.js +16 -0
- package/src/components/playlist/layout/playlist-layout-vertical.js +19 -0
- package/src/components/playlist/layout/playlist-layout.js +110 -0
- package/src/components/playlist/panel/playlist-panel-item.js +86 -0
- package/src/components/playlist/panel/playlist-panel.js +92 -0
- package/src/components/playlist/playlist-widget.js +119 -0
- package/src/components/playlist/playlist.const.js +14 -0
- package/src/components/playlist/playlist.js +413 -0
- package/src/components/playlist/thumbnail/thumbnail.js +69 -0
- package/src/components/progress-control-events-blocker/progress-control-events-blocker.js +17 -0
- package/src/components/qualitySelector/quality-selector.scss +10 -0
- package/src/components/qualitySelector/qualitySelector.js +152 -0
- package/src/components/recommendations-overlay/index.js +3 -0
- package/src/components/recommendations-overlay/recommendations-overlay-content.js +57 -0
- package/src/components/recommendations-overlay/recommendations-overlay-hide-button.js +18 -0
- package/src/components/recommendations-overlay/recommendations-overlay-item.js +35 -0
- package/src/components/recommendations-overlay/recommendations-overlay-primary-item.js +81 -0
- package/src/components/recommendations-overlay/recommendations-overlay-secondary-item.js +48 -0
- package/src/components/recommendations-overlay/recommendations-overlay-secondary-items-container.js +35 -0
- package/src/components/recommendations-overlay/recommendations-overlay.js +94 -0
- package/src/components/recommendations-overlay/recommendations-overlay.scss +182 -0
- package/src/components/shoppable-bar/layout/bar-layout.js +111 -0
- package/src/components/shoppable-bar/layout/shoppable-panel-toggle.js +64 -0
- package/src/components/shoppable-bar/layout/shoppable-products-overlay.js +87 -0
- package/src/components/shoppable-bar/panel/shoppable-panel-item.js +105 -0
- package/src/components/shoppable-bar/panel/shoppable-panel.js +172 -0
- package/src/components/shoppable-bar/shoppable-post-widget.js +110 -0
- package/src/components/shoppable-bar/shoppable-widget.const.js +52 -0
- package/src/components/shoppable-bar/shoppable-widget.js +111 -0
- package/src/components/shoppable-bar/shoppable-widget.scss +359 -0
- package/src/components/themeButton/themedButton.const.js +3 -0
- package/src/components/themeButton/themedButton.js +25 -0
- package/src/components/title-bar/title-bar.js +79 -0
- package/src/config/defaults.js +25 -0
- package/src/extended-events.js +228 -0
- package/src/index.js +18 -0
- package/src/mixins/eventable.js +54 -0
- package/src/mixins/playlistable.js +106 -0
- package/src/plugins/analytics/index.js +245 -0
- package/src/plugins/autoplay-on-scroll/index.js +86 -0
- package/src/plugins/cloudinary/common.js +216 -0
- package/src/plugins/cloudinary/event-handler-registry.js +46 -0
- package/src/plugins/cloudinary/index.js +345 -0
- package/src/plugins/cloudinary/models/audio-source/audio-source.const.js +11 -0
- package/src/plugins/cloudinary/models/audio-source/audio-source.js +82 -0
- package/src/plugins/cloudinary/models/base-source.js +107 -0
- package/src/plugins/cloudinary/models/image-source.js +26 -0
- package/src/plugins/cloudinary/models/video-source/video-source.const.js +32 -0
- package/src/plugins/cloudinary/models/video-source/video-source.js +239 -0
- package/src/plugins/cloudinary/models/video-source/video-source.utils.js +57 -0
- package/src/plugins/colors/index.js +303 -0
- package/src/plugins/context-menu/components/context-menu-item.js +12 -0
- package/src/plugins/context-menu/components/context-menu.js +63 -0
- package/src/plugins/context-menu/context-menu.scss +30 -0
- package/src/plugins/context-menu/contextMenuContent.js +53 -0
- package/src/plugins/context-menu/index.js +134 -0
- package/src/plugins/dash/index.js +26 -0
- package/src/plugins/dash/setup-audio-tracks.js +112 -0
- package/src/plugins/dash/setup-text-tracks.js +195 -0
- package/src/plugins/dash/videojs-dash.js +372 -0
- package/src/plugins/floating-player/floating-player.scss +74 -0
- package/src/plugins/floating-player/index.js +129 -0
- package/src/plugins/ima/index.js +1775 -0
- package/src/plugins/index.js +31 -0
- package/src/plugins/interactive-plugin/index.js +10 -0
- package/src/plugins/videojs-http-source-selector/components/SourceMenuButton.js +98 -0
- package/src/plugins/videojs-http-source-selector/components/SourceMenuItem.js +52 -0
- package/src/plugins/videojs-http-source-selector/plugin.js +82 -0
- package/src/plugins/videojs-http-source-selector/plugin.scss +9 -0
- package/src/plugins/vtt-thumbnails/index.js +526 -0
- package/src/plugins/vtt-thumbnails/vtt-thumbnails.scss +29 -0
- package/src/utils/api.js +32 -0
- package/src/utils/apply-with-props.js +32 -0
- package/src/utils/array.js +22 -0
- package/src/utils/assign.js +27 -0
- package/src/utils/attributes-normalizer.js +72 -0
- package/src/utils/cloudinary.js +165 -0
- package/src/utils/css-prefix.js +43 -0
- package/src/utils/dom.js +74 -0
- package/src/utils/find.js +28 -0
- package/src/utils/fontFace.js +25 -0
- package/src/utils/groupBy.js +12 -0
- package/src/utils/index.js +29 -0
- package/src/utils/matches.js +11 -0
- package/src/utils/mixin.js +5 -0
- package/src/utils/object.js +26 -0
- package/src/utils/playButton.js +9 -0
- package/src/utils/positioning.js +78 -0
- package/src/utils/querystring.js +12 -0
- package/src/utils/slicing.js +21 -0
- package/src/utils/string.js +15 -0
- package/src/utils/throttle.js +30 -0
- package/src/utils/time.js +77 -0
- package/src/utils/type-inference.js +35 -0
- package/src/validators/validators-functions.js +48 -0
- package/src/validators/validators-types.js +78 -0
- package/src/validators/validators.js +110 -0
- package/src/video-player.const.js +68 -0
- package/src/video-player.js +761 -0
- package/src/video-player.utils.js +123 -0
- package/test/adaptive-streaming.test.js +38 -0
- package/test/ads.test.js +35 -0
- package/test/analytics.test.js +111 -0
- package/test/api.test.js +111 -0
- package/test/autoplay.scroll.test.js +23 -0
- package/test/basic-ui.test.js +59 -0
- package/test/colors.test.js +58 -0
- package/test/components.test.js +21 -0
- package/test/custom-error.test.js +24 -0
- package/test/fluid.test.js +36 -0
- package/test/isValidConfig.test.js +224 -0
- package/test/mocks/cloudinary-core-mock.js +0 -0
- package/test/mocks/styleMock.js +1 -0
- package/test/multiplayer.test.js +25 -0
- package/test/playlist.test.js +60 -0
- package/test/puppeteer/vp-env.js +19 -0
- package/test/recommendations.test.js +38 -0
- package/test/title-bar.test.js +28 -0
- package/test/ui-conf.test.js +49 -0
- package/test/unit/cloudinaryConfig.test.js +22 -0
- package/test/unit/cloudinaryUtils.test.js +53 -0
- package/test/unit/utils.test.js +27 -0
- package/test/unit/videoSource.test.js +454 -0
- package/tsconfig.json +15 -0
- package/types/video-player-tests.js +12 -0
- package/types/video-player-tests.ts +31 -0
- package/types/video-player.d.ts +570 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Cloudinary Video Player</title>
|
|
6
|
+
<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"
|
|
7
|
+
rel="icon" type="image/png">
|
|
8
|
+
|
|
9
|
+
<!-- Bootstrap -->
|
|
10
|
+
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"
|
|
11
|
+
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
|
12
|
+
|
|
13
|
+
<!-- highlight.js -->
|
|
14
|
+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-light.min.css">
|
|
15
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
|
|
16
|
+
<script>hljs.initHighlightingOnLoad();</script>
|
|
17
|
+
|
|
18
|
+
<!--
|
|
19
|
+
We're loading scripts & style dynamically for development/testing.
|
|
20
|
+
Real-world usage would look like this:
|
|
21
|
+
|
|
22
|
+
<link rel="stylesheet" href="https://unpkg.com/cloudinary-video-player/dist/cld-video-player.min.css">
|
|
23
|
+
|
|
24
|
+
<script src="https://unpkg.com/cloudinary-core/cloudinary-core-shrinkwrap.js"></script>
|
|
25
|
+
<script src="https://unpkg.com/cloudinary-video-player/dist/cld-video-player.min.js"></script>
|
|
26
|
+
|
|
27
|
+
-->
|
|
28
|
+
|
|
29
|
+
<script type="text/javascript" src="./scripts.js"></script>
|
|
30
|
+
|
|
31
|
+
<script type="text/javascript">
|
|
32
|
+
window.addEventListener('load', function() {
|
|
33
|
+
|
|
34
|
+
var cld = cloudinary.Cloudinary.new({cloud_name: 'demo'});
|
|
35
|
+
var player = cld.videoPlayer('player', {
|
|
36
|
+
html5: {
|
|
37
|
+
hls: {
|
|
38
|
+
overrideNative: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
player.source(
|
|
44
|
+
'sea_turtle',
|
|
45
|
+
{
|
|
46
|
+
sourceTypes: ['hls'],
|
|
47
|
+
transformation: {streaming_profile: 'hd'},
|
|
48
|
+
textTracks: {
|
|
49
|
+
captions: {
|
|
50
|
+
label: "English(captions)",
|
|
51
|
+
language: "en",
|
|
52
|
+
default: true,
|
|
53
|
+
url: "https://res.cloudinary.com/demo/raw/upload/outdoors.vtt"
|
|
54
|
+
},
|
|
55
|
+
subtitles: [
|
|
56
|
+
{
|
|
57
|
+
label: "English",
|
|
58
|
+
language: "en",
|
|
59
|
+
url: "https://res.cloudinary.com/demo/raw/upload/outdoors.vtt"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
}, false);
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
</head>
|
|
70
|
+
<body>
|
|
71
|
+
<div class="container p-4 col-12 col-md-9 col-xl-6">
|
|
72
|
+
<nav class="nav mb-2">
|
|
73
|
+
<a href="./index.html"><< Back to examples index</a>
|
|
74
|
+
</nav>
|
|
75
|
+
<h1>Cloudinary Video Player</h1>
|
|
76
|
+
<h3 class="mb-4">Force HLS Subtitles</h3>
|
|
77
|
+
|
|
78
|
+
<video
|
|
79
|
+
id="player"
|
|
80
|
+
controls
|
|
81
|
+
muted
|
|
82
|
+
autoplay
|
|
83
|
+
class="cld-video-player"
|
|
84
|
+
crossorigin="anonymous"
|
|
85
|
+
width="500">
|
|
86
|
+
</video>
|
|
87
|
+
|
|
88
|
+
<p class="mt-4">
|
|
89
|
+
<a href="https://cloudinary.com/documentation/cloudinary_video_player">Full documentation</a>
|
|
90
|
+
</p>
|
|
91
|
+
|
|
92
|
+
<h3 class="mt-4">Example Code:</h3>
|
|
93
|
+
<p>To force subtitles in an HLS stream even if the manifest does not declare them, add the following to the player configuration and then add your text tracks in the source:</p>
|
|
94
|
+
<pre>
|
|
95
|
+
<code class="language-javascript">
|
|
96
|
+
html5: {
|
|
97
|
+
hls: {
|
|
98
|
+
overrideNative: true,
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
</code>
|
|
102
|
+
</pre>
|
|
103
|
+
|
|
104
|
+
<p>Make sure to add the following to your video element as the subtitles are coming from a different origin:</p>
|
|
105
|
+
<pre>
|
|
106
|
+
<code class="language-html">
|
|
107
|
+
crossorigin="anonymous"
|
|
108
|
+
</code>
|
|
109
|
+
</pre>
|
|
110
|
+
<p>See full example:</p>
|
|
111
|
+
<pre>
|
|
112
|
+
<code class="language-html">
|
|
113
|
+
<video
|
|
114
|
+
id="player"
|
|
115
|
+
controls
|
|
116
|
+
muted
|
|
117
|
+
class="cld-video-player"
|
|
118
|
+
crossorigin="anonymous"
|
|
119
|
+
width="500"
|
|
120
|
+
></video>
|
|
121
|
+
</code>
|
|
122
|
+
<code class="language-javascript"> var cld = cloudinary.Cloudinary.new({cloud_name: 'demo'});
|
|
123
|
+
var player = cld.videoPlayer('player', {
|
|
124
|
+
html5: {
|
|
125
|
+
hls: {
|
|
126
|
+
overrideNative: true,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
player.source(
|
|
132
|
+
'sea_turtle',
|
|
133
|
+
{
|
|
134
|
+
sourceTypes: ['hls'],
|
|
135
|
+
transformation: {streaming_profile: 'hd'},
|
|
136
|
+
textTracks: {
|
|
137
|
+
captions: {
|
|
138
|
+
label: "English(captions)",
|
|
139
|
+
language: "en",
|
|
140
|
+
default: true,
|
|
141
|
+
url: "https://res.cloudinary.com/demo/raw/upload/outdoors.vtt"
|
|
142
|
+
},
|
|
143
|
+
subtitles: [
|
|
144
|
+
{
|
|
145
|
+
label: "English",
|
|
146
|
+
language: "en",
|
|
147
|
+
url: "https://res.cloudinary.com/demo/raw/upload/outdoors.vtt"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
</code>
|
|
155
|
+
</pre>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
</body>
|
|
159
|
+
</html>
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Cloudinary Video Player</title>
|
|
6
|
+
<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">
|
|
7
|
+
|
|
8
|
+
<!-- Bootstrap -->
|
|
9
|
+
<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">
|
|
10
|
+
|
|
11
|
+
<!--
|
|
12
|
+
We're loading scripts & style dynamically for development/testing.
|
|
13
|
+
Real-world usage would look like this:
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="https://unpkg.com/cloudinary-video-player/dist/cld-video-player.min.css">
|
|
16
|
+
|
|
17
|
+
<script src="https://unpkg.com/cloudinary-core/cloudinary-core-shrinkwrap.js"></script>
|
|
18
|
+
<script src="https://unpkg.com/cloudinary-video-player/dist/cld-video-player.min.js"></script>
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
<script type="text/javascript" src="scripts.js"></script>
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript">
|
|
24
|
+
window.addEventListener('load', function(){
|
|
25
|
+
|
|
26
|
+
var cld = cloudinary.Cloudinary.new({ cloud_name: 'demo' });
|
|
27
|
+
|
|
28
|
+
player = cld.videoPlayer('player');
|
|
29
|
+
|
|
30
|
+
}, false);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
</head>
|
|
34
|
+
<body>
|
|
35
|
+
|
|
36
|
+
<div class="container p-4 col-12 col-md-9 col-xl-6">
|
|
37
|
+
<h1 class="mb-4">Cloudinary Video Player</h1>
|
|
38
|
+
|
|
39
|
+
<video
|
|
40
|
+
id="player"
|
|
41
|
+
controls
|
|
42
|
+
muted
|
|
43
|
+
class="cld-video-player cld-video-player-skin-dark cld-fluid"
|
|
44
|
+
data-cld-source='{ "publicId": "sea_turtle", "info": { "title": "Sea turtle", "subtitle": "Short movie about a sea turtle" } }'>
|
|
45
|
+
</video>
|
|
46
|
+
|
|
47
|
+
<p class="mt-4">
|
|
48
|
+
<a href="https://cloudinary.com/documentation/cloudinary_video_player">Full documentation @ cloudinary.com/documentation</a>
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
<h3 class="mt-4">Some code examples:</h3>
|
|
52
|
+
<ul>
|
|
53
|
+
<li><a href="./api.html">API and Events</a></li>
|
|
54
|
+
<li><a href="./playlist.html">Playlist</a></li>
|
|
55
|
+
<li><a href="./playlist-by-tag.html">Playlist by Tag</a></li>
|
|
56
|
+
<li><a href="./autoplay-on-scroll.html">Autoplay on Scroll</a></li>
|
|
57
|
+
<li><a href="./multiple-players.html">Multiple Players</a></li>
|
|
58
|
+
<li><a href="./adaptive-streaming.html">Adaptive Streaming</a></li>
|
|
59
|
+
<li><a href="./audio.html">Audio Player</a></li>
|
|
60
|
+
<li><a href="./analytics.html">Analytics</a></li>
|
|
61
|
+
<li><a href="./components.html">Components</a></li>
|
|
62
|
+
<li><a href="./recommendations.html">Recommendations</a></li>
|
|
63
|
+
<li><a href="./fluid.html">Fluid Layouts</a></li>
|
|
64
|
+
<li><a href="./vast-vpaid.html">VAST & VPAID Support</a></li>
|
|
65
|
+
<li><a href="./360.html">360 Videos</a></li>
|
|
66
|
+
<li><a href="./floating-player.html">Floating Player</a></li>
|
|
67
|
+
<li><a href="./colors.html">Colors API</a></li>
|
|
68
|
+
<li><a href="./ui-config.html">Display Configurations</a></li>
|
|
69
|
+
<li><a href="./poster.html">Poster Options</a></li>
|
|
70
|
+
<li><a href="./subtitles-and-captions.html">Subtitles & Captions</a></li>
|
|
71
|
+
<li><a href="./force-hls-subtitles-ios.html">Force HLS Subtitles</a></li>
|
|
72
|
+
<li><a href="./custom-cld-errors.html">Custom Errors</a></li>
|
|
73
|
+
<li><a href="./codec-fallback.html">Codec and Fallback</a></li>
|
|
74
|
+
<li><a href="./live-customer.html">Live customer</a></li>
|
|
75
|
+
<li><a href="./shoppable.html">Shoppable Videos</a></li>
|
|
76
|
+
<li><a href="./transformations.html">Video Transformations</a></li>
|
|
77
|
+
<li><a href="./raw-url.html">Raw URL</a></li>
|
|
78
|
+
<li><a href="./seek-thumbs.html">Seek Thumbnails</a></li>
|
|
79
|
+
</ul>
|
|
80
|
+
|
|
81
|
+
</div>
|
|
82
|
+
</body>
|
|
83
|
+
</html>
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Cloudinary Video Player</title>
|
|
6
|
+
<style>
|
|
7
|
+
.video-container{
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
}
|
|
11
|
+
</style>
|
|
12
|
+
<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">
|
|
13
|
+
|
|
14
|
+
<!-- Bootstrap -->
|
|
15
|
+
<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">
|
|
16
|
+
|
|
17
|
+
<!-- highlight.js -->
|
|
18
|
+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-light.min.css">
|
|
19
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
|
|
20
|
+
<script>hljs.initHighlightingOnLoad();</script>
|
|
21
|
+
|
|
22
|
+
<script type="text/javascript" src="./scripts.js"></script>
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript">
|
|
25
|
+
|
|
26
|
+
window.addEventListener('load', function() {
|
|
27
|
+
|
|
28
|
+
var cld = cloudinary.Cloudinary.new({cloud_name: 'demo'});
|
|
29
|
+
|
|
30
|
+
var playerOption = {
|
|
31
|
+
bigPlayButton: false,
|
|
32
|
+
interactionAreas: {
|
|
33
|
+
theme:{
|
|
34
|
+
template : 'pulsing'
|
|
35
|
+
},
|
|
36
|
+
layout: {
|
|
37
|
+
enable: true,
|
|
38
|
+
showAgain: false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var sources = {
|
|
44
|
+
topSource : 'https://res.cloudinary.com/eran2903/video/upload/w_880,x_800,y_200,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4',
|
|
45
|
+
bottomSource: 'https://res.cloudinary.com/eran2903/video/upload/w_540,x_1260,y_3100,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4'
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var player = cld.videoPlayer('manually', playerOption);
|
|
49
|
+
|
|
50
|
+
player.source('video-player/girl_in_a_dress', {
|
|
51
|
+
interactionAreas:{
|
|
52
|
+
enable: true,
|
|
53
|
+
template: [
|
|
54
|
+
{
|
|
55
|
+
left : 10 ,
|
|
56
|
+
top: 10,
|
|
57
|
+
width: 80,
|
|
58
|
+
height: 40,
|
|
59
|
+
id: 'topSource'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
left : 10 ,
|
|
63
|
+
top: 75,
|
|
64
|
+
width: 80,
|
|
65
|
+
height : 20,
|
|
66
|
+
id: 'bottomSource'
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
onClick: function (event) {
|
|
70
|
+
event.zoom(sources[event.item.id]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
var videoZoomSources = {
|
|
76
|
+
top:'https://res.cloudinary.com/eran2903/video/upload/w_880,x_800,y_200,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4',
|
|
77
|
+
middle:'https://www2.hm.com/en_in/productpage.0687948004.html',
|
|
78
|
+
bottom:'https://res.cloudinary.com/eran2903/video/upload/w_540,x_1260,y_3100,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var player2 = cld.videoPlayer('custom-template', playerOption);
|
|
82
|
+
|
|
83
|
+
player2.source('video-player/girl_in_a_dress', {
|
|
84
|
+
interactionAreas: {
|
|
85
|
+
enable: true,
|
|
86
|
+
template: 'portrait',
|
|
87
|
+
onClick:function (event) {
|
|
88
|
+
var src = videoZoomSources[event.item.id];
|
|
89
|
+
if(event.item.id === 'middle'){
|
|
90
|
+
if(window.confirm('Do you like this shirt ?')) {
|
|
91
|
+
window.open(src, '_blank').focus();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
event.zoom(src)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
var player3 = cld.videoPlayer('custom-vtt', playerOption);
|
|
102
|
+
|
|
103
|
+
var videoZoomSources3 = {
|
|
104
|
+
center : 'https://res.cloudinary.com/eran2903/video/upload/w_880,x_800,y_200,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4'
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
player3.source('video-player/girl_in_a_dress', {
|
|
108
|
+
interactionAreas: {
|
|
109
|
+
enable: true,
|
|
110
|
+
vttUrl: 'https://res.cloudinary.com/prod/raw/upload/v1623250265/video-player/vtts/center.vtt',
|
|
111
|
+
onClick: function (event) {
|
|
112
|
+
event.zoom(videoZoomSources3[event.item.id]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
var player4 = cld.videoPlayer('auto-zoom', playerOption);
|
|
119
|
+
|
|
120
|
+
player4.source('video-player/girl_in_a_dress', {
|
|
121
|
+
transformation:{
|
|
122
|
+
quality: 'auto',
|
|
123
|
+
},
|
|
124
|
+
interactionAreas: {
|
|
125
|
+
enable: true,
|
|
126
|
+
template: 'portrait',
|
|
127
|
+
onClick: function (event) {
|
|
128
|
+
event.zoom();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
});
|
|
134
|
+
</script>
|
|
135
|
+
</head>
|
|
136
|
+
<body>
|
|
137
|
+
|
|
138
|
+
<div class="container p-4 col-12 col-md-9 col-xl-6">
|
|
139
|
+
|
|
140
|
+
<nav class="nav mb-2">
|
|
141
|
+
<a href="./index.html"><< Back to examples index</a>
|
|
142
|
+
</nav>
|
|
143
|
+
<h1>Cloudinary Video Player</h1>
|
|
144
|
+
|
|
145
|
+
<br/>
|
|
146
|
+
|
|
147
|
+
<h3>Interaction Areas player config:</h3>
|
|
148
|
+
|
|
149
|
+
<pre>
|
|
150
|
+
<code class="language-javascript">
|
|
151
|
+
var cld = cloudinary.Cloudinary.new({cloud_name: 'demo'});
|
|
152
|
+
|
|
153
|
+
cld.videoPlayer('player', {
|
|
154
|
+
interactionAreas: {
|
|
155
|
+
theme:{
|
|
156
|
+
template : 'pulsing' // 'pulsing' / 'shadowed' (the default is 'pulsing')
|
|
157
|
+
},
|
|
158
|
+
layout: {
|
|
159
|
+
enable: true / false (the default is true),
|
|
160
|
+
showAgain: true / false (the default is false)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
</code>
|
|
165
|
+
</pre>
|
|
166
|
+
|
|
167
|
+
<h3>Define Interaction Areas manually</h3>
|
|
168
|
+
|
|
169
|
+
<br/>
|
|
170
|
+
<div class="video-container">
|
|
171
|
+
<video id="manually"
|
|
172
|
+
width="250"
|
|
173
|
+
playsinline
|
|
174
|
+
controls
|
|
175
|
+
muted
|
|
176
|
+
class="cld-video-player">
|
|
177
|
+
</video>
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<pre>
|
|
181
|
+
<code class="language-html">
|
|
182
|
+
|
|
183
|
+
<video
|
|
184
|
+
id="player"
|
|
185
|
+
width="250"
|
|
186
|
+
controls
|
|
187
|
+
muted
|
|
188
|
+
class="cld-video-player">
|
|
189
|
+
</video>
|
|
190
|
+
</code>
|
|
191
|
+
|
|
192
|
+
<code class="language-javascript">
|
|
193
|
+
var cld = cloudinary.Cloudinary.new({cloud_name: 'demo'});
|
|
194
|
+
|
|
195
|
+
var sources = {
|
|
196
|
+
topSource : 'https://res.cloudinary.com/eran2903/video/upload/w_880,x_800,y_200,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4',
|
|
197
|
+
bottomSource: 'https://res.cloudinary.com/eran2903/video/upload/w_540,x_1260,y_3100,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4'
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
var player = cld.videoPlayer('player',{
|
|
201
|
+
bigPlayButton: false
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
player.source('video-player/girl_in_a_dress',{
|
|
205
|
+
interactionAreas: {
|
|
206
|
+
enable: true,
|
|
207
|
+
template: [
|
|
208
|
+
{
|
|
209
|
+
left : 10 ,
|
|
210
|
+
top: 10,
|
|
211
|
+
width: 80,
|
|
212
|
+
height: 40,
|
|
213
|
+
id: 'topSource'
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
left : 10 ,
|
|
217
|
+
top: 75,
|
|
218
|
+
width: 80,
|
|
219
|
+
height : 20,
|
|
220
|
+
id: 'bottomSource'
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
onClick: function (event) {
|
|
224
|
+
event.zoom(sources[event.item.id]);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
</code>
|
|
229
|
+
|
|
230
|
+
</pre>
|
|
231
|
+
|
|
232
|
+
<br/>
|
|
233
|
+
|
|
234
|
+
<h3>Interaction Areas using predefined templates</h3>
|
|
235
|
+
|
|
236
|
+
<br/>
|
|
237
|
+
|
|
238
|
+
<div class="video-container">
|
|
239
|
+
<video id="custom-template"
|
|
240
|
+
width="250"
|
|
241
|
+
playsinline
|
|
242
|
+
controls
|
|
243
|
+
muted
|
|
244
|
+
class="cld-video-player">
|
|
245
|
+
</video>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<pre>
|
|
249
|
+
<code class="language-html">
|
|
250
|
+
<video
|
|
251
|
+
id="player"
|
|
252
|
+
width="250"
|
|
253
|
+
controls
|
|
254
|
+
muted
|
|
255
|
+
class="cld-video-player">
|
|
256
|
+
</video>
|
|
257
|
+
</code>
|
|
258
|
+
|
|
259
|
+
<code class="language-javascript">
|
|
260
|
+
var cld = cloudinary.Cloudinary.new({cloud_name: 'demo'});
|
|
261
|
+
|
|
262
|
+
var player = cld.videoPlayer('player',{
|
|
263
|
+
bigPlayButton: false
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
var sources = {
|
|
267
|
+
top:'https://res.cloudinary.com/eran2903/video/upload/w_880,x_800,y_200,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4',
|
|
268
|
+
middle:'https://www2.hm.com/en_in/productpage.0687948004.html',
|
|
269
|
+
bottom:'https://res.cloudinary.com/eran2903/video/upload/w_540,x_1260,y_3100,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4'
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
player.source('video-player/girl_in_a_dress', {
|
|
273
|
+
interactionAreas: {
|
|
274
|
+
enable: true,
|
|
275
|
+
template: 'portrait', // or landscape/all/center
|
|
276
|
+
onClick: function(event) {
|
|
277
|
+
// 'event.item.id' is an id that been defined in the vtt file
|
|
278
|
+
var src = sources[event.item.id];
|
|
279
|
+
if(event.item.id === 'middle'){
|
|
280
|
+
if(window.confirm("Do you like this shirt ?")) {
|
|
281
|
+
window.open(src, '_blank').focus();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
event.zoom(src)
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
</code>
|
|
291
|
+
|
|
292
|
+
</pre>
|
|
293
|
+
|
|
294
|
+
<h3>Using your own VTT file</h3>
|
|
295
|
+
|
|
296
|
+
<br/>
|
|
297
|
+
|
|
298
|
+
<div class="video-container">
|
|
299
|
+
<video id="custom-vtt"
|
|
300
|
+
width="250"
|
|
301
|
+
playsinline
|
|
302
|
+
controls
|
|
303
|
+
muted
|
|
304
|
+
class="cld-video-player">
|
|
305
|
+
</video>
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
<pre>
|
|
310
|
+
<code class="language-html">
|
|
311
|
+
<video
|
|
312
|
+
id="player"
|
|
313
|
+
width="250"
|
|
314
|
+
controls
|
|
315
|
+
muted
|
|
316
|
+
class="cld-video-player">
|
|
317
|
+
</video>
|
|
318
|
+
</code>
|
|
319
|
+
|
|
320
|
+
<code class="language-javascript">
|
|
321
|
+
var cld = cloudinary.Cloudinary.new({cloud_name: 'demo'});
|
|
322
|
+
|
|
323
|
+
var player = cld.videoPlayer('player',{
|
|
324
|
+
bigPlayButton: false
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
var sources = {
|
|
328
|
+
center : 'https://res.cloudinary.com/eran2903/video/upload/w_880,x_800,y_200,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4'
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
player.source('video-player/girl_in_a_dress', {
|
|
332
|
+
interactionAreas: {
|
|
333
|
+
enable: true,
|
|
334
|
+
vttUrl: 'https://res.cloudinary.com/prod/raw/upload/v1623250265/video-player/vtts/center.vtt',
|
|
335
|
+
onClick: function(event) {
|
|
336
|
+
// 'event.item.id' is an id that been defined in the vtt file
|
|
337
|
+
event.zoom(sources[event.item.id]);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
</code>
|
|
342
|
+
|
|
343
|
+
</pre>
|
|
344
|
+
|
|
345
|
+
<h3>Auto-zoom video cropping</h3>
|
|
346
|
+
|
|
347
|
+
<br/>
|
|
348
|
+
|
|
349
|
+
<div class="video-container">
|
|
350
|
+
<video id="auto-zoom"
|
|
351
|
+
width="250"
|
|
352
|
+
playsinline
|
|
353
|
+
controls
|
|
354
|
+
muted
|
|
355
|
+
class="cld-video-player">
|
|
356
|
+
</video>
|
|
357
|
+
</div>
|
|
358
|
+
|
|
359
|
+
<pre>
|
|
360
|
+
<code class="language-html">
|
|
361
|
+
<video
|
|
362
|
+
id="player"
|
|
363
|
+
controls
|
|
364
|
+
muted
|
|
365
|
+
class="cld-video-player">
|
|
366
|
+
</video>
|
|
367
|
+
</code>
|
|
368
|
+
|
|
369
|
+
<code class="language-javascript">
|
|
370
|
+
var cld = cloudinary.Cloudinary.new({cloud_name: 'demo'});
|
|
371
|
+
|
|
372
|
+
var player = cld.videoPlayer('player', {
|
|
373
|
+
bigPlayButton: false
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// auto-zoom works only if the source is a cloudinary source object or a public id
|
|
377
|
+
// does not work for a full raw url
|
|
378
|
+
player.source('video-player/girl_in_a_dress', {
|
|
379
|
+
transformation:{
|
|
380
|
+
quality: 'auto',
|
|
381
|
+
},
|
|
382
|
+
interactionAreas: {
|
|
383
|
+
enable: true,
|
|
384
|
+
template: 'portrait',
|
|
385
|
+
onClick: function (event) {
|
|
386
|
+
//in case you not passing a source to the zoom function auto zoom will be enabled
|
|
387
|
+
event.zoom();
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
</code>
|
|
392
|
+
|
|
393
|
+
</pre>
|
|
394
|
+
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
</body>
|
|
398
|
+
</html>
|