@vidispine/vdt-videojs 21.3.0 → 22.1.0-pre.1
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/README.md +4 -4
- package/deprecated-app/README.md +21 -0
- package/{demo.html → deprecated-app/index.html} +1 -1
- package/{demo.js → deprecated-app/index.js} +69 -41
- package/{samples → deprecated-app/samples}/birds-es.vvt +0 -0
- package/{samples → deprecated-app/samples}/birds.vvt +0 -0
- package/{tests.js → deprecated-app/tests.js} +87 -54
- package/{lib/style.css → dist/index.css} +755 -55
- package/dist/index.es.js +2099 -0
- package/dist/index.js +2112 -0
- package/dist/index.umd.js +2115 -0
- package/package.json +29 -85
- package/rollup.config.js +54 -0
- package/src/constants.js +1 -1
- package/src/externalControls.js +14 -18
- package/src/helpOverlay.js +12 -16
- package/src/helpers.js +3 -3
- package/src/index.js +3 -9
- package/src/index.stories.mdx +59 -0
- package/src/menu.api.stories.mdx +59 -0
- package/src/menu.js +23 -19
- package/src/{menu.example.md → menu.usage.stories.mdx} +31 -21
- package/src/osd.js +24 -18
- package/src/player.api.stories.mdx +120 -0
- package/src/player.js +157 -108
- package/src/player.scss +2 -0
- package/src/{player.example.md → player.usage.stories.mdx} +18 -8
- package/src/seekBar.js +85 -48
- package/src/timeCodeDisplay.js +39 -31
- package/src/videoTime.js +4 -4
- package/build.js +0 -233
- package/lib/index.cjs.js +0 -3240
- package/lib/index.esm.js +0 -3227
- package/lib/index.umd.js +0 -3243
- package/lib/package.json +0 -13
- package/lib/src/constants.js +0 -51
- package/lib/src/externalControls.js +0 -307
- package/lib/src/helpOverlay.js +0 -106
- package/lib/src/helpers.js +0 -34
- package/lib/src/index.js +0 -13
- package/lib/src/menu.js +0 -365
- package/lib/src/osd.js +0 -91
- package/lib/src/player.js +0 -943
- package/lib/src/seekBar.js +0 -833
- package/lib/src/timeCodeDisplay.js +0 -253
- package/lib/src/videoTime.js +0 -66
- package/log.js +0 -24
- package/src/_index.stories.js +0 -24
- package/src/externalControls.stories.js +0 -6
- package/src/helpOverlay.stories.js +0 -6
- package/src/menu.classMethods.md +0 -47
- package/src/player.classMethods.md +0 -108
- package/src/player.stories.js +0 -14
- package/src/seekBar.stories.js +0 -8
- package/tmp/player.css +0 -1
package/lib/src/menu.js
DELETED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
import mousetrap from 'mousetrap';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const constants = Object.freeze({
|
|
5
|
-
className: 'vdt-menu',
|
|
6
|
-
menuClassName: 'menu',
|
|
7
|
-
subLvlClassName: 'sub-level',
|
|
8
|
-
menuItemClassName: 'menu-item',
|
|
9
|
-
animationLength: 300,
|
|
10
|
-
defaults: {
|
|
11
|
-
bgColor: 'rgba(0,0,0,.8)',
|
|
12
|
-
textColor: '#999',
|
|
13
|
-
textColorDark: '#333',
|
|
14
|
-
textColorLight: 'rgba(255,255,255)',
|
|
15
|
-
bgColorLight: 'rgba(255,255,255,.2)',
|
|
16
|
-
bgColorSelected: 'rgba(255,255,255,.1)',
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const CSS = () => `
|
|
22
|
-
.${constants.menuClassName}{
|
|
23
|
-
position: relative;
|
|
24
|
-
height: 100%;
|
|
25
|
-
width: 200%;
|
|
26
|
-
// min-width: 200px;
|
|
27
|
-
right: 0px;
|
|
28
|
-
bottom: 0px;
|
|
29
|
-
background: ${constants.defaults.bgColor};
|
|
30
|
-
z-index: 1px;
|
|
31
|
-
transform: translate3d(100%, 0px, 0px);
|
|
32
|
-
transition: all 300ms ease-in-out;
|
|
33
|
-
box-shadow: 0px 0px 30px rgb;
|
|
34
|
-
-webkit-backdrop-filter: blur(10px);
|
|
35
|
-
overflow: hidden;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.${constants.menuClassName} .level-1{
|
|
39
|
-
float: left;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.${constants.menuClassName} div h3{
|
|
43
|
-
padding: 16px 24px;
|
|
44
|
-
font-size: 12px;
|
|
45
|
-
border-bottom: 1px solid ${constants.defaults.bgColorLight}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.${constants.menuClassName} .level-2 h3{
|
|
49
|
-
cursor: pointer;
|
|
50
|
-
position: relative;
|
|
51
|
-
}
|
|
52
|
-
.${constants.menuClassName} .level-2 h3:before{
|
|
53
|
-
content: 'â';
|
|
54
|
-
margin-left: -12px;
|
|
55
|
-
width: 12px;
|
|
56
|
-
display: inline-block;
|
|
57
|
-
position: absolute;
|
|
58
|
-
margin-top: -1px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.${constants.menuClassName} .level-1,
|
|
62
|
-
.${constants.menuClassName} .level-2{
|
|
63
|
-
transform: translate3d(0px, 0px, 0px);
|
|
64
|
-
transition: all 300ms ease-in-out;
|
|
65
|
-
width: 50%;
|
|
66
|
-
height: 100%;
|
|
67
|
-
float: left;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.${constants.menuClassName}.sub-level .level-1,
|
|
71
|
-
.${constants.menuClassName}.sub-level .level-2{
|
|
72
|
-
transform: translate3d(-100%, 0px, 0px);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.${constants.menuClassName} table{
|
|
76
|
-
border-collapse: collapse;
|
|
77
|
-
width: 100%;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.${constants.menuClassName}.open{
|
|
81
|
-
transform: translate3d(0px, 0px, 0px);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.${constants.menuClassName} tr{
|
|
85
|
-
cursor: pointer;
|
|
86
|
-
height: 40px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.${constants.menuClassName} tr.selected{
|
|
90
|
-
background: ${constants.defaults.bgColorSelected};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
.${constants.menuClassName} tr td{
|
|
95
|
-
color: white;
|
|
96
|
-
font-size: 15px;
|
|
97
|
-
vertical-align: middle;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
.${constants.menuClassName} tr:hover td{
|
|
102
|
-
color: white;
|
|
103
|
-
background: ${constants.defaults.bgColorLight};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.${constants.menuClassName} tr td.title{
|
|
107
|
-
padding-top: 12px;
|
|
108
|
-
padding-bottom: 12px;
|
|
109
|
-
font-weight: 300;
|
|
110
|
-
font-family: Helvetica, Arial, sans-serif;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.${constants.menuClassName} tr td.caret{
|
|
114
|
-
font-size: 12px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.${constants.menuClassName} tr td:first-child{
|
|
118
|
-
padding-left: 24px;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.${constants.menuClassName} tr td:last-child{
|
|
122
|
-
padding-right: 16px;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.${constants.menuClassName} tr.has-items td:last-child{
|
|
126
|
-
text-align: right;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.${constants.menuClassName} tr.has-items td.subtitle{
|
|
130
|
-
font-size: 12px;
|
|
131
|
-
text-align: right;
|
|
132
|
-
color: ${constants.defaults.textColorLight};
|
|
133
|
-
}
|
|
134
|
-
`;
|
|
135
|
-
|
|
136
|
-
class MenuDisplayItem {
|
|
137
|
-
constructor(props) {
|
|
138
|
-
this.props = props;
|
|
139
|
-
|
|
140
|
-
const classNames = [
|
|
141
|
-
constants.menuItemClassName,
|
|
142
|
-
this.props.items && 'has-items',
|
|
143
|
-
this.props.selected && 'selected',
|
|
144
|
-
];
|
|
145
|
-
this.container = document.createElement('tr');
|
|
146
|
-
this.container.className = classNames.join(' ');
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.props.target && this.props.target.appendChild(this.container);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.container.onclick = (event) => {
|
|
153
|
-
this.props.onClick && this.props.onClick(event);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
this.render();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
render() {
|
|
160
|
-
if (this.props.items) {
|
|
161
|
-
this.container.innerHTML = `
|
|
162
|
-
<td class="title"></td>
|
|
163
|
-
<td class="subtitle"></td>
|
|
164
|
-
<td class="caret">â·</td>
|
|
165
|
-
`;
|
|
166
|
-
} else {
|
|
167
|
-
this.container.innerHTML = `
|
|
168
|
-
<td class="title"></td>
|
|
169
|
-
`;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const titleNode = this.container.getElementsByClassName('title')[0];
|
|
173
|
-
const subtitleNode = (this.props.items) ? this.container.getElementsByClassName('subtitle')[0] : false;
|
|
174
|
-
|
|
175
|
-
titleNode.textContent = this.props.title;
|
|
176
|
-
subtitleNode && (subtitleNode.textContent = this.props.subtitle);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export default class Menu {
|
|
181
|
-
constructor(props) {
|
|
182
|
-
this.props = props;
|
|
183
|
-
|
|
184
|
-
this.container = document.createElement('div');
|
|
185
|
-
this.container.className = `${constants.className}`;
|
|
186
|
-
|
|
187
|
-
this.state = {
|
|
188
|
-
opened: false,
|
|
189
|
-
selectedItem: 0,
|
|
190
|
-
items: [],
|
|
191
|
-
subItems: [],
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
this.mount();
|
|
195
|
-
this.draw();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
mount() {
|
|
199
|
-
|
|
200
|
-
if (this.props.target) {
|
|
201
|
-
|
|
202
|
-
this.container.style.position = 'absolute';
|
|
203
|
-
this.container.style.bottom = this.container.style.right = '0px';
|
|
204
|
-
this.container.style.height = '100%';
|
|
205
|
-
this.container.style.overflow = 'hidden';
|
|
206
|
-
this.container.style.width = '30%';
|
|
207
|
-
this.container.style.minWidth = '250px';
|
|
208
|
-
this.container.style.maxWidth = '320px';
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
this.shadow = this.container.attachShadow({ mode: 'open' });
|
|
212
|
-
this.props.target && this.props.target.appendChild(this.container);
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
this.menuContainer = document.createElement('div');
|
|
217
|
-
this.menuContainer.className = 'menu';
|
|
218
|
-
|
|
219
|
-
this.shadow.appendChild(this.menuContainer);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
this.style = document.createElement('style');
|
|
223
|
-
this.style.type = 'text/css';
|
|
224
|
-
this.style.innerHTML = CSS();
|
|
225
|
-
this.shadow.appendChild(this.style);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
draw() {
|
|
230
|
-
const mainDiv = document.createElement('div');
|
|
231
|
-
mainDiv.className = 'level-1';
|
|
232
|
-
this.mainLevel = document.createElement('table');
|
|
233
|
-
mainDiv.innerHTML = '<h3>Settings</h3>';
|
|
234
|
-
mainDiv.appendChild(this.mainLevel);
|
|
235
|
-
|
|
236
|
-
const subDiv = document.createElement('div');
|
|
237
|
-
subDiv.className = 'level-2';
|
|
238
|
-
this.subLvlTitle = document.createElement('h3');
|
|
239
|
-
this.subLvlTitle.onclick = () => { this.up(); };
|
|
240
|
-
subDiv.appendChild(this.subLvlTitle);
|
|
241
|
-
this.secondaryLevel = document.createElement('table');
|
|
242
|
-
subDiv.appendChild(this.secondaryLevel);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
this.menuContainer.appendChild(mainDiv);
|
|
246
|
-
this.menuContainer.appendChild(subDiv);
|
|
247
|
-
|
|
248
|
-
this.props.items.forEach((menuItem) => {
|
|
249
|
-
|
|
250
|
-
const activeTitle = menuItem.items[menuItem.getActiveIndex(menuItem.items)].title || '';
|
|
251
|
-
const displayItem = new MenuDisplayItem({
|
|
252
|
-
target: this.mainLevel,
|
|
253
|
-
subtitle: activeTitle,
|
|
254
|
-
onClick: () => {
|
|
255
|
-
this.handleSupItemSelected(menuItem);
|
|
256
|
-
},
|
|
257
|
-
...menuItem,
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
this.state.items.push(displayItem);
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
open() {
|
|
265
|
-
this.render();
|
|
266
|
-
|
|
267
|
-
this.menuContainer.classList.add('open');
|
|
268
|
-
this.props.onOpen && this.props.onOpen();
|
|
269
|
-
this.state.opened = true;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if (!this.handleClicksWhenMenuOpened) {
|
|
273
|
-
this.handleClicksWhenMenuOpened = function (event) {
|
|
274
|
-
if (this.state.opened) {
|
|
275
|
-
event.stopPropagation();
|
|
276
|
-
const isClickInside = this.container.contains(event.target);
|
|
277
|
-
if (!isClickInside) {
|
|
278
|
-
this.close();
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}.bind(this);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
this.handleClicksWhenMenuOpenedTimeout = setTimeout(() => {
|
|
285
|
-
document.addEventListener('click', this.handleClicksWhenMenuOpened);
|
|
286
|
-
mousetrap.bind('esc', this.close.bind(this));
|
|
287
|
-
}, constants.animationLength);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
close() {
|
|
291
|
-
this.menuContainer.classList.remove('open');
|
|
292
|
-
this.state.opened = false;
|
|
293
|
-
|
|
294
|
-
this.handleClicksWhenMenuOpenedTimeout && clearTimeout(this.handleClicksWhenMenuOpenedTimeout);
|
|
295
|
-
document.removeEventListener('click', this.handleClicksWhenMenuOpened);
|
|
296
|
-
|
|
297
|
-
this.props.onClose && this.props.onClose();
|
|
298
|
-
|
|
299
|
-
mousetrap.unbind('esc');
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
toggle() {
|
|
303
|
-
if (this.state.opened) {
|
|
304
|
-
this.close();
|
|
305
|
-
} else {
|
|
306
|
-
this.open();
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
up() {
|
|
311
|
-
this.menuContainer.classList.remove(constants.subLvlClassName);
|
|
312
|
-
this.render();
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
handleSupItemSelected(item) {
|
|
316
|
-
this.subLvlTitle.textContent = item.title;
|
|
317
|
-
this.renderSubItems(item.items, item.getActiveIndex(item.items));
|
|
318
|
-
this.menuContainer.classList.add(constants.subLvlClassName);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
renderSubItems(items, activeIndex = false) {
|
|
322
|
-
this.secondaryLevel.innerHTML = '';
|
|
323
|
-
|
|
324
|
-
const subItemRefs = [];
|
|
325
|
-
items.forEach((menuItem, index) => {
|
|
326
|
-
const displayItem = new MenuDisplayItem({
|
|
327
|
-
target: this.secondaryLevel,
|
|
328
|
-
...menuItem,
|
|
329
|
-
onClick: (event) => {
|
|
330
|
-
this.handleSubItemSelected(event, menuItem);
|
|
331
|
-
},
|
|
332
|
-
selected: (index === activeIndex),
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
subItemRefs.push(displayItem);
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
this.state.subItems = subItemRefs;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
handleSubItemSelected(event, item) {
|
|
342
|
-
this.close();
|
|
343
|
-
item.onClick && item.onClick(event, item);
|
|
344
|
-
this.up();
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
get opened() {
|
|
348
|
-
return this.state.opened;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
set opened(bool) {
|
|
352
|
-
this.state.opened = bool;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
render() {
|
|
356
|
-
|
|
357
|
-
this.state.items.forEach((menuDisplayItem, index) => {
|
|
358
|
-
const { items } = this.props;
|
|
359
|
-
const activeIndex = items[index].getActiveIndex(items[index].items);
|
|
360
|
-
const activeTitle = items[index].items[activeIndex].title;
|
|
361
|
-
menuDisplayItem.props.subtitle = activeTitle;
|
|
362
|
-
menuDisplayItem.render();
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
}
|
package/lib/src/osd.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import constants from './constants';
|
|
3
|
-
|
|
4
|
-
export default class OSD {
|
|
5
|
-
constructor(props) {
|
|
6
|
-
this.props = props;
|
|
7
|
-
|
|
8
|
-
this.state = {
|
|
9
|
-
enabled: true,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
this.container = document.createElement('div');
|
|
13
|
-
this.container.className = 'vdt-player-osd';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.container.innerHTML = `
|
|
17
|
-
<table>
|
|
18
|
-
<tbody>
|
|
19
|
-
<td>
|
|
20
|
-
<div class="osd-feedback-icon"></div>
|
|
21
|
-
</td>
|
|
22
|
-
</tbody>
|
|
23
|
-
</table>
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
this.iconEl = this.container.getElementsByClassName('osd-feedback-icon')[0];
|
|
27
|
-
|
|
28
|
-
this.props.target && this.props.target.appendChild(this.container);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
feedback(feedbackType, details = null) {
|
|
32
|
-
if (!this.state.enabled) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let className;
|
|
37
|
-
|
|
38
|
-
switch (feedbackType) {
|
|
39
|
-
case constants.osd.pause:
|
|
40
|
-
className = 'pause';
|
|
41
|
-
break;
|
|
42
|
-
case constants.osd.play:
|
|
43
|
-
className = 'play';
|
|
44
|
-
break;
|
|
45
|
-
case constants.osd.volchange:
|
|
46
|
-
const currentVolumeLevel = details.volume;
|
|
47
|
-
let perceivedVolumeLevel;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (currentVolumeLevel === 0) { perceivedVolumeLevel = 'null'; } else
|
|
52
|
-
if (currentVolumeLevel > 0.65) { perceivedVolumeLevel = 'high'; } else
|
|
53
|
-
if (currentVolumeLevel < 0.35) { perceivedVolumeLevel = 'low'; } else { perceivedVolumeLevel = 'mid'; }
|
|
54
|
-
|
|
55
|
-
className = `volchange ${perceivedVolumeLevel}`;
|
|
56
|
-
break;
|
|
57
|
-
case constants.osd.jumpForward:
|
|
58
|
-
className = 'forward-jump';
|
|
59
|
-
break;
|
|
60
|
-
case constants.osd.jumpBackward:
|
|
61
|
-
className = 'backward-jump';
|
|
62
|
-
break;
|
|
63
|
-
default:
|
|
64
|
-
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (this.osdTimeout) {
|
|
70
|
-
this.container.classList.remove('active');
|
|
71
|
-
clearTimeout(this.osdTimeout);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.container.classList.add('active');
|
|
76
|
-
this.osdTimeout = setTimeout(() => {
|
|
77
|
-
this.container.classList.remove('active');
|
|
78
|
-
}, 200);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this.iconEl.className = `osd-feedback-icon ${className}`;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
disable() {
|
|
85
|
-
this.state.enabled = false;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
enable() {
|
|
89
|
-
this.state.enabled = true;
|
|
90
|
-
}
|
|
91
|
-
}
|