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
package/docs/scripts.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/* eslint no-var: "off", vars-on-top: "off", curly: "off", no-extend-native: "off" */
|
|
2
|
+
|
|
3
|
+
// String.startsWith() polyfill
|
|
4
|
+
if (!String.prototype.startsWith) {
|
|
5
|
+
String.prototype.startsWith = function (searchString, position) {
|
|
6
|
+
position = position || 0;
|
|
7
|
+
return this.substr(position, searchString.length) === searchString;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// URLSearchParams.get() polyfill
|
|
12
|
+
if (!window.URLSearchParams) {
|
|
13
|
+
window.URLSearchParams = window.URLSearchParams || function (searchString) {
|
|
14
|
+
var self = this;
|
|
15
|
+
self.searchString = searchString;
|
|
16
|
+
self.get = function (name) {
|
|
17
|
+
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(self.searchString);
|
|
18
|
+
|
|
19
|
+
if (results === null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return decodeURI(results[1]) || 0;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// true on /localhost or /anything.local
|
|
29
|
+
var isLocal = window.location.hostname === 'localhost' || window.location.hostname.substring(window.location.hostname.lastIndexOf('.', window.location.hostname.lastIndexOf('.')) + 1) === 'local';
|
|
30
|
+
|
|
31
|
+
// true if testing in an IP page URL
|
|
32
|
+
var isIpAddress = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(window.location.hostname);
|
|
33
|
+
|
|
34
|
+
var cdnPrefix = function (source, ver) {
|
|
35
|
+
var external = source.startsWith('http');
|
|
36
|
+
|
|
37
|
+
if (!ver && (external || isLocal || isIpAddress)) {
|
|
38
|
+
return '';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return 'https://unpkg.com/cloudinary-video-player@' + (ver || 'edge') + '/dist';
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Get scripts & styles from:
|
|
45
|
+
// `localhost` while developing (localhost/ip address/.local domain)
|
|
46
|
+
// `unpkg.com` while demoing OR if a specific version is specified
|
|
47
|
+
// These MUST be global since they are called by some examples
|
|
48
|
+
var loadScript = function (source, ver) {
|
|
49
|
+
var prefix = cdnPrefix(source, ver);
|
|
50
|
+
var script = document.createElement('script');
|
|
51
|
+
script.type = 'text/javascript';
|
|
52
|
+
script.src = prefix + source;
|
|
53
|
+
script.async = false;
|
|
54
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var loadStyle = function (source, ver) {
|
|
58
|
+
var prefix = cdnPrefix(source, ver);
|
|
59
|
+
var style = document.createElement('link');
|
|
60
|
+
style.type = 'text/css';
|
|
61
|
+
style.rel = 'stylesheet';
|
|
62
|
+
style.href = prefix + source;
|
|
63
|
+
document.getElementsByTagName('head')[0].appendChild(style);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
(function () {
|
|
67
|
+
|
|
68
|
+
// Allows testing of various build flavors (min/light) & versions (1.1.x)
|
|
69
|
+
var search = new URLSearchParams(window.location.search);
|
|
70
|
+
var ver = search.get('ver');
|
|
71
|
+
var min = search.get('min');
|
|
72
|
+
var light = search.get('light');
|
|
73
|
+
|
|
74
|
+
var versions = [
|
|
75
|
+
{ label: 'Select Player Version:' },
|
|
76
|
+
{ value: 'ver=latest', label: 'Stable (Latest)' },
|
|
77
|
+
{ value: 'ver=latest&min=true', label: 'Stable, Minified' },
|
|
78
|
+
{ value: 'ver=latest&light=true', label: 'Stable, Light' },
|
|
79
|
+
{ value: 'ver=latest&min=true&light=true', label: 'Stable, Light, Minified' },
|
|
80
|
+
{ value: 'ver=edge', label: 'Edge (Next Stable)' },
|
|
81
|
+
{ value: 'ver=edge&min=true', label: 'Edge, Minified' },
|
|
82
|
+
{ value: 'ver=edge&light=true', label: 'Edge, Light' },
|
|
83
|
+
{ value: 'ver=edge&min=true&light=true', label: 'Edge, Light, Minified' }
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
initPlayerExamples();
|
|
87
|
+
|
|
88
|
+
function createVersionSelector() {
|
|
89
|
+
// Create and append select list
|
|
90
|
+
var selectList = document.createElement('select');
|
|
91
|
+
selectList.id = 'version-switch';
|
|
92
|
+
selectList.style.cssText = 'appearance: none;position:fixed;bottom:20px;right:20px;background:#fff;min-width:220px;height:2em;border:1px solid #ddd;padding:0 1em;';
|
|
93
|
+
selectList.onchange = function (e) {
|
|
94
|
+
var selected = e.target.value;
|
|
95
|
+
if (selected) {
|
|
96
|
+
window.location.href = window.location.origin + window.location.pathname + '?' + selected;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
document.body.appendChild(selectList);
|
|
100
|
+
|
|
101
|
+
// Current flavor
|
|
102
|
+
var current = 'ver=' + (ver || !isLocal && 'edge');
|
|
103
|
+
if (min) current = current + '&min=' + min;
|
|
104
|
+
if (light) current = current + '&light=' + light;
|
|
105
|
+
|
|
106
|
+
// Create and append the options
|
|
107
|
+
versions.forEach(function (version){
|
|
108
|
+
var option = document.createElement('option');
|
|
109
|
+
option.text = version.label;
|
|
110
|
+
|
|
111
|
+
if (version.value) {
|
|
112
|
+
option.value = version.value;
|
|
113
|
+
// Find if this is the flavor currently in use
|
|
114
|
+
if (option.value === current) {
|
|
115
|
+
option.selected = true;
|
|
116
|
+
option.text = 'Testing: ' + option.text;
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
// 'Select Player Version:'
|
|
120
|
+
option.disabled = true;
|
|
121
|
+
option.selected = true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
selectList.appendChild(option);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function updatePageAnchors() {
|
|
129
|
+
// Maintain the 'ver' query param on internal links.
|
|
130
|
+
document.querySelectorAll('a').forEach(function (a) {
|
|
131
|
+
if (a.hostname === location.hostname) {
|
|
132
|
+
var url = a.href + '?';
|
|
133
|
+
if (ver) url = url + 'ver=' + ver + '&';
|
|
134
|
+
if (min) url = url + 'min=' + min + '&';
|
|
135
|
+
if (light) url = url + 'light=' + light;
|
|
136
|
+
a.setAttribute('href', url);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function initPlayerExamples() {
|
|
142
|
+
loadScript('https://unpkg.com/cloudinary-core/cloudinary-core-shrinkwrap.js');
|
|
143
|
+
loadStyle('/cld-video-player' + (light ? '.light' : '') + (min ? '.min' : '') + '.css', ver);
|
|
144
|
+
loadScript('/cld-video-player' + (light ? '.light' : '') + (min ? '.min' : '') + '.js', ver);
|
|
145
|
+
|
|
146
|
+
window.addEventListener('load', function () {
|
|
147
|
+
|
|
148
|
+
createVersionSelector();
|
|
149
|
+
|
|
150
|
+
if (ver || min || light) {
|
|
151
|
+
updatePageAnchors();
|
|
152
|
+
}
|
|
153
|
+
}, false);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
}());
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Cloudinary Video Player</title>
|
|
6
|
+
<link href="https://cloudinary-res.cloudinary.com/image/asset/favicon-32x32-2991a47c2caa80211bf2dbf3f29317c8.png" rel="icon" sizes="32x32" 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
|
+
<!-- highlight.js -->
|
|
12
|
+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-light.min.css">
|
|
13
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
|
|
14
|
+
<script>hljs.initHighlightingOnLoad();</script>
|
|
15
|
+
|
|
16
|
+
<!--
|
|
17
|
+
We're loading scripts & style dynamically for development/testing.
|
|
18
|
+
Real-world usage would look like this:
|
|
19
|
+
|
|
20
|
+
<link rel="stylesheet" href="https://unpkg.com/cloudinary-video-player/dist/cld-video-player.min.css">
|
|
21
|
+
|
|
22
|
+
<script src="https://unpkg.com/cloudinary-core/cloudinary-core-shrinkwrap.js"></script>
|
|
23
|
+
<script src="https://unpkg.com/cloudinary-video-player/dist/cld-video-player.min.js"></script>
|
|
24
|
+
|
|
25
|
+
-->
|
|
26
|
+
|
|
27
|
+
<script type="text/javascript" src="./scripts.js"></script>
|
|
28
|
+
|
|
29
|
+
<script type="text/javascript">
|
|
30
|
+
window.addEventListener('load', function(){
|
|
31
|
+
|
|
32
|
+
var cld = cloudinary.Cloudinary.new({ cloud_name: 'demo' });
|
|
33
|
+
|
|
34
|
+
var player = cld.videoPlayer('player', {
|
|
35
|
+
seekThumbnails: true
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
}, false);
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
</head>
|
|
42
|
+
<body>
|
|
43
|
+
<div class="container p-4 col-12 col-md-9 col-xl-6">
|
|
44
|
+
<nav class="nav mb-2">
|
|
45
|
+
<a href="./index.html"><< Back to examples index</a>
|
|
46
|
+
</nav>
|
|
47
|
+
<h1>Cloudinary Video Player</h1>
|
|
48
|
+
<h3 class="mb-4">Seek Thumbnails</h3>
|
|
49
|
+
|
|
50
|
+
<video
|
|
51
|
+
id="player"
|
|
52
|
+
playsinline
|
|
53
|
+
controls
|
|
54
|
+
muted
|
|
55
|
+
autoplay
|
|
56
|
+
class="cld-video-player cld-fluid cld-video-player-skin-light"
|
|
57
|
+
data-cld-public-id="elephants">
|
|
58
|
+
</video>
|
|
59
|
+
|
|
60
|
+
<p class="mt-4">
|
|
61
|
+
<a href="https://cloudinary.com/documentation/cloudinary_video_player">Full documentation</a>
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
<h3 class="mt-4">Example Code:</h3>
|
|
65
|
+
<pre>
|
|
66
|
+
<code class="language-html">
|
|
67
|
+
<video
|
|
68
|
+
id="player"
|
|
69
|
+
playsinline
|
|
70
|
+
controls
|
|
71
|
+
muted
|
|
72
|
+
autoplay
|
|
73
|
+
class="cld-video-player cld-fluid cld-video-player-skin-light"
|
|
74
|
+
data-cld-public-id="elephants">
|
|
75
|
+
</video>
|
|
76
|
+
</code>
|
|
77
|
+
<code class="language-javascript">
|
|
78
|
+
var cld = cloudinary.Cloudinary.new({ cloud_name: 'demo' });
|
|
79
|
+
|
|
80
|
+
// Initialize player
|
|
81
|
+
var player = cld.videoPlayer('player', {
|
|
82
|
+
seekThumbnails: true
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
</code>
|
|
86
|
+
</pre>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
</body>
|
|
90
|
+
</html>
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>Cloudinary Video Player</title>
|
|
7
|
+
<meta name="viewport" content="width=device-width">
|
|
8
|
+
<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">
|
|
9
|
+
|
|
10
|
+
<!-- Bootstrap -->
|
|
11
|
+
<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">
|
|
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
|
+
<script type="text/javascript" src="./scripts.js"></script>
|
|
29
|
+
|
|
30
|
+
<script type="text/javascript">
|
|
31
|
+
window.addEventListener('load', function () {
|
|
32
|
+
|
|
33
|
+
var cld = cloudinary.Cloudinary.new({ cloud_name: 'demo' });
|
|
34
|
+
|
|
35
|
+
player = cld.videoPlayer('player');
|
|
36
|
+
|
|
37
|
+
var source = {
|
|
38
|
+
info: {
|
|
39
|
+
title: 'Shoppable Video',
|
|
40
|
+
description: 'Browse products shown in the video.',
|
|
41
|
+
},
|
|
42
|
+
shoppable: {
|
|
43
|
+
startState: 'openOnPlay',
|
|
44
|
+
autoClose: 2,
|
|
45
|
+
showPostPlayOverlay: true,
|
|
46
|
+
bannerMsg: 'START SHOPPING',
|
|
47
|
+
width: '20%',
|
|
48
|
+
toggleIcon: "https://res.cloudinary.com/cloudinary/image/upload/c_scale,w_200/v1/logo/for_white_bg/cloudinary_icon_for_white_bg.png",
|
|
49
|
+
transformation: {
|
|
50
|
+
crop: "fill",
|
|
51
|
+
aspect_ratio: "1"
|
|
52
|
+
},
|
|
53
|
+
products: [
|
|
54
|
+
{
|
|
55
|
+
productId: 1,
|
|
56
|
+
productName: "Bell Pepper",
|
|
57
|
+
startTime: 0,
|
|
58
|
+
endTime: 2,
|
|
59
|
+
title: 'Overlay on-hover & seek on-click',
|
|
60
|
+
publicId: "docs/pepper",
|
|
61
|
+
hotspots: [
|
|
62
|
+
{
|
|
63
|
+
time: "00:02",
|
|
64
|
+
x: "80%",
|
|
65
|
+
y: "30%",
|
|
66
|
+
tooltipPosition: "bottom",
|
|
67
|
+
clickUrl: "https://www.example.net/product-one"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
onHover: {
|
|
71
|
+
action: "overlay",
|
|
72
|
+
args: "Click to see this product in the video"
|
|
73
|
+
},
|
|
74
|
+
onClick: {
|
|
75
|
+
action: "seek",
|
|
76
|
+
pause: 5,
|
|
77
|
+
args: {
|
|
78
|
+
time: "00:02"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
productId: 2,
|
|
84
|
+
productName: "Tomato",
|
|
85
|
+
startTime: 2,
|
|
86
|
+
endTime: 5,
|
|
87
|
+
publicId: "docs/tomatoes",
|
|
88
|
+
onHover: {
|
|
89
|
+
action: "switch",
|
|
90
|
+
args: {
|
|
91
|
+
publicId: "docs/tomatoes_alternate"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
onClick: {
|
|
95
|
+
action: "goto",
|
|
96
|
+
pause: true,
|
|
97
|
+
args: {
|
|
98
|
+
url: "https://www.example.net/product-two"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
productId: 3,
|
|
104
|
+
productName: "Banana",
|
|
105
|
+
startTime: 7,
|
|
106
|
+
endTime: 11,
|
|
107
|
+
publicId:
|
|
108
|
+
"docs/banana",
|
|
109
|
+
onHover: {
|
|
110
|
+
action: "switch",
|
|
111
|
+
args: {
|
|
112
|
+
publicId: "docs/banana_alternate"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
onClick: {
|
|
116
|
+
action: "goto",
|
|
117
|
+
pause: true,
|
|
118
|
+
args: {
|
|
119
|
+
url:
|
|
120
|
+
"https://www.example.net/product-three"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
productName: 'Product 4',
|
|
126
|
+
productId: 4,
|
|
127
|
+
publicId: 'balloons'
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
productName: 'Product 5',
|
|
131
|
+
productId: 5,
|
|
132
|
+
publicId: 'friends'
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
player.source('snow_horses', source);
|
|
139
|
+
|
|
140
|
+
// Player Events
|
|
141
|
+
player.on('productHover', function (e, data) {
|
|
142
|
+
console.log('Product Hover: ' + JSON.stringify(data));
|
|
143
|
+
});
|
|
144
|
+
player.on('productClick', function (e, data) {
|
|
145
|
+
console.log('Product Click: ' + JSON.stringify(data));
|
|
146
|
+
});
|
|
147
|
+
player.on('productBarMin', function (e) {
|
|
148
|
+
console.log('Product bar close');
|
|
149
|
+
});
|
|
150
|
+
player.on('productBarMax', function (e) {
|
|
151
|
+
console.log('Product bar open');
|
|
152
|
+
});
|
|
153
|
+
player.on('replay', function (e) {
|
|
154
|
+
console.log('replay');
|
|
155
|
+
});
|
|
156
|
+
player.on('productHoverPost', function (e, data) {
|
|
157
|
+
console.log('Product Hover Post Playback: ' + JSON.stringify(data));
|
|
158
|
+
});
|
|
159
|
+
player.on('productClickPost', function (e, data) {
|
|
160
|
+
console.log('Product Click Post Playback: ' + JSON.stringify(data));
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
}, false);
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
</head>
|
|
167
|
+
|
|
168
|
+
<body>
|
|
169
|
+
<div class="container p-4 col-12 col-md-9 col-xl-6">
|
|
170
|
+
<nav class="nav mb-2">
|
|
171
|
+
<a href="./index.html"><< Back to examples index</a>
|
|
172
|
+
</nav>
|
|
173
|
+
<h1>Cloudinary Video Player</h1>
|
|
174
|
+
<h3 class="mb-4">Shoppable Videos</h3>
|
|
175
|
+
|
|
176
|
+
<video id="player" playsinline controls muted
|
|
177
|
+
class="cld-video-player cld-fluid cld-video-player-skin-light"></video>
|
|
178
|
+
|
|
179
|
+
<p class="mt-4">
|
|
180
|
+
<a href="https://cloudinary.com/documentation/cloudinary_video_player">Full documentation</a>
|
|
181
|
+
</p>
|
|
182
|
+
|
|
183
|
+
<h3 class="mt-4">Example Code:</h3>
|
|
184
|
+
<pre>
|
|
185
|
+
<code class="language-html">
|
|
186
|
+
<video
|
|
187
|
+
id="player"
|
|
188
|
+
playsinline
|
|
189
|
+
controls
|
|
190
|
+
muted
|
|
191
|
+
autoplay
|
|
192
|
+
class="cld-video-player cld-fluid cld-video-player-skin-light"
|
|
193
|
+
></video>
|
|
194
|
+
</code>
|
|
195
|
+
<code class="language-javascript">
|
|
196
|
+
var cld = cloudinary.Cloudinary.new({ cloud_name: 'demo' });
|
|
197
|
+
|
|
198
|
+
// Initialize player
|
|
199
|
+
var player = cld.videoPlayer('player');
|
|
200
|
+
|
|
201
|
+
// Define source
|
|
202
|
+
var source = {
|
|
203
|
+
info: {
|
|
204
|
+
title: 'Shoppable Video',
|
|
205
|
+
description: 'Browse products shown in the video.',
|
|
206
|
+
},
|
|
207
|
+
shoppable: {
|
|
208
|
+
startState: 'openOnPlay',
|
|
209
|
+
autoClose: 2,
|
|
210
|
+
showPostPlayOverlay: true,
|
|
211
|
+
bannerMsg: 'START SHOPPING',
|
|
212
|
+
width: '20%',
|
|
213
|
+
toggleIcon: "https://res.cloudinary.com/cloudinary/image/upload/c_scale,w_200/v1/logo/for_white_bg/cloudinary_icon_for_white_bg.png",
|
|
214
|
+
transformation: {
|
|
215
|
+
crop: "fill",
|
|
216
|
+
aspect_ratio: "1"
|
|
217
|
+
},
|
|
218
|
+
products: [
|
|
219
|
+
{
|
|
220
|
+
productId: 1,
|
|
221
|
+
productName: "Bell Pepper",
|
|
222
|
+
startTime: 0,
|
|
223
|
+
endTime: 2,
|
|
224
|
+
title: 'Overlay on-hover & seek on-click',
|
|
225
|
+
publicId: "docs/pepper",
|
|
226
|
+
hotspots: [
|
|
227
|
+
{
|
|
228
|
+
time: "00:02",
|
|
229
|
+
x: "50%",
|
|
230
|
+
y: "50%",
|
|
231
|
+
tooltipPosition: "left",
|
|
232
|
+
clickUrl: "https://www.example.net/product-one"
|
|
233
|
+
}
|
|
234
|
+
],
|
|
235
|
+
onHover: {
|
|
236
|
+
action: "overlay",
|
|
237
|
+
args: "Click to see this product in the video"
|
|
238
|
+
},
|
|
239
|
+
onClick: {
|
|
240
|
+
action: "seek",
|
|
241
|
+
pause: 5,
|
|
242
|
+
args: {
|
|
243
|
+
time: "00:01"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
productId: 2,
|
|
249
|
+
productName: "Tomato",
|
|
250
|
+
startTime: 2,
|
|
251
|
+
endTime: 5,
|
|
252
|
+
publicId: "docs/tomatoes",
|
|
253
|
+
onHover: {
|
|
254
|
+
action: "switch",
|
|
255
|
+
args: {
|
|
256
|
+
publicId: "docs/tomatoes_alternate"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
onClick: {
|
|
260
|
+
action: "goto",
|
|
261
|
+
pause: true,
|
|
262
|
+
args: {
|
|
263
|
+
url: "https://www.example.net/product-two"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
productId: 3,
|
|
269
|
+
productName: "Banana",
|
|
270
|
+
startTime: 7,
|
|
271
|
+
endTime: 11,
|
|
272
|
+
publicId:
|
|
273
|
+
"docs/banana",
|
|
274
|
+
onHover: {
|
|
275
|
+
action: "switch",
|
|
276
|
+
args: {
|
|
277
|
+
publicId: "docs/banana_alternate"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
onClick: {
|
|
281
|
+
action: "goto",
|
|
282
|
+
pause: true,
|
|
283
|
+
args: {
|
|
284
|
+
url:
|
|
285
|
+
"https://www.example.net/product-three"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
productName: 'Product 4',
|
|
291
|
+
productId: 4,
|
|
292
|
+
publicId: 'balloons'
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
productName: 'Product 5',
|
|
296
|
+
productId: 5,
|
|
297
|
+
publicId: 'friends'
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// Play source
|
|
304
|
+
player.source('snow_horses', source);
|
|
305
|
+
|
|
306
|
+
// Player Events
|
|
307
|
+
player.on('productHover', function (e, data) {
|
|
308
|
+
console.log('Product Hover: ' + JSON.stringify(data));
|
|
309
|
+
});
|
|
310
|
+
player.on('productClick', function (e, data) {
|
|
311
|
+
console.log('Product Click: ' + JSON.stringify(data));
|
|
312
|
+
});
|
|
313
|
+
player.on('productBarMin', function (e) {
|
|
314
|
+
console.log('Product bar close');
|
|
315
|
+
});
|
|
316
|
+
player.on('productBarMax', function (e) {
|
|
317
|
+
console.log('Product bar open');
|
|
318
|
+
});
|
|
319
|
+
player.on('replay', function (e) {
|
|
320
|
+
console.log('replay');
|
|
321
|
+
});
|
|
322
|
+
player.on('productHoverPost', function (e, data) {
|
|
323
|
+
console.log('Product Hover Post Playback: ' + JSON.stringify(data));
|
|
324
|
+
});
|
|
325
|
+
player.on('productClickPost', function (e, data) {
|
|
326
|
+
console.log('Product Click Post Playback: ' + JSON.stringify(data));
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
</code>
|
|
330
|
+
</pre>
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
</body>
|
|
334
|
+
|
|
335
|
+
</html>
|