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,74 @@
|
|
|
1
|
+
.cld-video-player-floater {
|
|
2
|
+
position: static;
|
|
3
|
+
transition: all 0.5s ease-out;
|
|
4
|
+
transition-property: bottom, right, left;
|
|
5
|
+
|
|
6
|
+
.cld-video-player-floater-close {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Floated
|
|
11
|
+
&.cld-video-player-floating {
|
|
12
|
+
position: fixed;
|
|
13
|
+
z-index: 9;
|
|
14
|
+
border: 4px solid #fff;
|
|
15
|
+
box-shadow: 0 3px 10px rgba(#000, .2);
|
|
16
|
+
|
|
17
|
+
.cld-video-player-floater-inner {
|
|
18
|
+
height: 0;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.cld-video-player-floater-close {
|
|
23
|
+
position: absolute;
|
|
24
|
+
bottom: 100%;
|
|
25
|
+
background: #fff;
|
|
26
|
+
border-bottom: none;
|
|
27
|
+
margin-bottom: 4px;
|
|
28
|
+
right: -4px;
|
|
29
|
+
padding: 4px 6px 2px;
|
|
30
|
+
display: block;
|
|
31
|
+
box-shadow: 0 0 4px rgba(#000, .05);
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
// Hide bottom shadow
|
|
34
|
+
&::after {
|
|
35
|
+
content: '';
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 100%;
|
|
38
|
+
right: 0;
|
|
39
|
+
width: 120%;
|
|
40
|
+
height: 4px;
|
|
41
|
+
background: #fff;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.vjs-time-control,
|
|
46
|
+
.vjs-upcoming-video-title-display,
|
|
47
|
+
.vjs-recommendations-overlay {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
.vjs-upcoming-video .vjs-upcoming-video-bar {
|
|
51
|
+
background-color: transparent;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.vjs-big-play-button {
|
|
55
|
+
font-size: 4em;
|
|
56
|
+
top: 40%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.cld-video-player-floater-bottom-right {
|
|
60
|
+
bottom: 20px !important;
|
|
61
|
+
right: 20px !important;
|
|
62
|
+
top: auto !important;
|
|
63
|
+
left: auto !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.cld-video-player-floater-bottom-left {
|
|
67
|
+
bottom: 20px !important;
|
|
68
|
+
left: 20px !important;
|
|
69
|
+
top: auto !important;
|
|
70
|
+
right: auto !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { isElementInViewport } from 'utils/positioning';
|
|
2
|
+
import { sliceProperties } from 'utils/slicing';
|
|
3
|
+
import { assign } from 'utils/assign';
|
|
4
|
+
import './floating-player.scss';
|
|
5
|
+
import { FLOATING_TO } from '../../video-player.const';
|
|
6
|
+
|
|
7
|
+
const defaults = {
|
|
8
|
+
fraction: 0.5,
|
|
9
|
+
collapsedWidth: 300,
|
|
10
|
+
floatTo: 'right'
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
class FloatingPlayer {
|
|
14
|
+
|
|
15
|
+
constructor(player, opts = {}) {
|
|
16
|
+
opts = assign({}, defaults, opts);
|
|
17
|
+
// Handle non left-right values.
|
|
18
|
+
if (opts.floatTo && opts.floatTo !== FLOATING_TO.LEFT && opts.floatTo !== FLOATING_TO.RIGHT) {
|
|
19
|
+
opts.floatTo = defaults.floatTo;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
this.player = player;
|
|
23
|
+
let _options = sliceProperties(opts, 'fraction');
|
|
24
|
+
|
|
25
|
+
let _floater = null;
|
|
26
|
+
let _floated = false;
|
|
27
|
+
let _wrapped = false;
|
|
28
|
+
|
|
29
|
+
this.init = () => {
|
|
30
|
+
registerEventHandlers();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const wrapInner = (parent) => {
|
|
34
|
+
const wrapper = document.createElement('div');
|
|
35
|
+
parent.appendChild(wrapper);
|
|
36
|
+
while (parent.firstChild !== wrapper) {
|
|
37
|
+
wrapper.appendChild(parent.firstChild);
|
|
38
|
+
}
|
|
39
|
+
return wrapper;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const removeWindowEventHandlers = () => {
|
|
43
|
+
window.removeEventListener('DOMContentLoaded', checkViewportState, false);
|
|
44
|
+
window.removeEventListener('load', checkViewportState, false);
|
|
45
|
+
window.removeEventListener('scroll', checkViewportState, false);
|
|
46
|
+
window.removeEventListener('resize', checkViewportState, false);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const addWindowEventHandlers = () => {
|
|
50
|
+
window.addEventListener('DOMContentLoaded', checkViewportState, false);
|
|
51
|
+
window.addEventListener('load', checkViewportState, false);
|
|
52
|
+
window.addEventListener('scroll', checkViewportState, false);
|
|
53
|
+
window.addEventListener('resize', checkViewportState, false);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const registerEventHandlers = () => {
|
|
57
|
+
this.player.on('play', checkViewportState);
|
|
58
|
+
this.player.on('play', addWindowEventHandlers);
|
|
59
|
+
// this.player.on('pause', removeWindowEventHandlers);
|
|
60
|
+
this.player.on('dispose', removeWindowEventHandlers);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const float = () => {
|
|
64
|
+
const el = this.player.el();
|
|
65
|
+
const elRect = el.getBoundingClientRect();
|
|
66
|
+
|
|
67
|
+
if (!_wrapped) {
|
|
68
|
+
// Create floater element
|
|
69
|
+
_floater = wrapInner(el);
|
|
70
|
+
_floater.setAttribute('class', 'cld-video-player-floater cld-video-player-floater-bottom-' + opts.floatTo);
|
|
71
|
+
_floater.setAttribute('style', [
|
|
72
|
+
'width: ' + opts.collapsedWidth + 'px;',
|
|
73
|
+
'top: ' + elRect.top + 'px;',
|
|
74
|
+
'left: ' + elRect.left + 'px;',
|
|
75
|
+
'right: ' + (document.documentElement.clientWidth - elRect.right) + 'px;',
|
|
76
|
+
'bottom: ' + (document.documentElement.clientHeight - elRect.bottom) + 'px;'
|
|
77
|
+
].join(''));
|
|
78
|
+
|
|
79
|
+
// Create inner element
|
|
80
|
+
const inner = wrapInner(_floater);
|
|
81
|
+
inner.setAttribute('class', 'cld-video-player-floater-inner');
|
|
82
|
+
inner.setAttribute('style', 'padding-bottom: ' + (100 * elRect.height / elRect.width) + '%;');
|
|
83
|
+
|
|
84
|
+
const close = document.createElement('button');
|
|
85
|
+
close.setAttribute('class', 'cld-video-player-floater-close');
|
|
86
|
+
close.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><polygon fill-rule="evenodd" points="370 7.41 368.59 6 364 10.59 359.41 6 358 7.41 362.59 12 358 16.59 359.41 18 364 13.41 368.59 18 370 16.59 365.41 12" transform="translate(-358 -6)"/></svg>';
|
|
87
|
+
close.onclick = () => {
|
|
88
|
+
unfloat();
|
|
89
|
+
disable();
|
|
90
|
+
};
|
|
91
|
+
_floater.appendChild(close);
|
|
92
|
+
|
|
93
|
+
_wrapped = true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
_floater.classList.add('cld-video-player-floating');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
_floated = true;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const unfloat = () => {
|
|
104
|
+
_floater.classList.remove('cld-video-player-floating');
|
|
105
|
+
_floated = false;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const disable = () => {
|
|
109
|
+
removeWindowEventHandlers();
|
|
110
|
+
this.player.off('play', checkViewportState);
|
|
111
|
+
this.player.off('play', addWindowEventHandlers);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const checkViewportState = () => {
|
|
115
|
+
const visible = isElementInViewport(this.player.el(), { fraction: _options.fraction });
|
|
116
|
+
if (visible) {
|
|
117
|
+
if (_floated) {
|
|
118
|
+
unfloat();
|
|
119
|
+
}
|
|
120
|
+
} else if (!_floated) {
|
|
121
|
+
float();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default function(opts = {}) {
|
|
128
|
+
new FloatingPlayer(this, opts).init();
|
|
129
|
+
}
|