@revideo/player 0.2.2 → 0.2.4-alpha.894
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/dist/main.js +225 -105
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var y = (h, r, t) =>
|
|
3
|
+
r in h
|
|
4
|
+
? p(h, r, {enumerable: !0, configurable: !0, writable: !0, value: t})
|
|
5
|
+
: (h[r] = t);
|
|
6
|
+
var e = (h, r, t) => (y(h, typeof r != 'symbol' ? r + '' : r, t), t);
|
|
7
|
+
import {Stage as M, Vector2 as b, Player as m} from '@revideo/core';
|
|
8
|
+
const v = `.initial{display:none}.state-initial .initial{display:block}.loading{display:none}.state-loading .loading{display:block}.ready{display:none}.state-ready .ready{display:block}.error{display:none}.state-error .error{display:block}:host{position:relative;display:block}.controls{position:absolute;left:0;right:0;display:flex;align-items:center;justify-content:space-between;bottom:0%;height:10%;background:rgba(0,0,0,0)}.timeline-container{height:100%;width:calc(100% - 32px);top:0%;position:absolute;z-index:5}.timeline{position:absolute;-webkit-appearance:none;-moz-appearance:none;appearance:none;margin-left:16px;margin-right:16px;width:100%;background:transparent;cursor:pointer;background-size:100% 40px;background-repeat:no-repeat;bottom:10px;z-index:10}.timeline::-webkit-slider-runnable-track{width:100%;height:5px;background:white;background:var(--webkit-track, white)}.timeline:hover::-webkit-slider-runnable-track{width:100%;height:5px;background:white;background:var(--webkit-track, white)}.timeline::-moz-range-track{width:100%;height:5px;background:white;background:var(--moz-track, white)}.timeline::-ms-track{width:100%;height:4px;background:white;background:var(--ms-track, rgb(201, 199, 199))}.timeline::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:16px;height:16px;background:#fff;border-radius:50%;cursor:pointer;opacity:0;transition:opacity .2s ease;margin-top:-6px}.timeline::-moz-range-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:16px;height:16px;background:#fff;border-radius:50%;cursor:pointer;opacity:0;transition:opacity .2s ease;margin-top:-6px}.timeline::-ms-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:16px;height:16px;background:#fff;border-radius:50%;cursor:pointer;opacity:0;transition:opacity .2s ease;margin-top:-6px}.timeline:hover::-webkit-slider-thumb{opacity:1;background:#fff}.timeline:hover::-moz-range-thumb{opacity:1;background:#fff}.timeline:hover::-ms-thumb{opacity:1;background:#fff}.overlay{position:absolute;left:0;right:0;top:0;bottom:0;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .1s;z-index:0}.overlay.state-ready:not(.auto){cursor:pointer}.overlay.playing:not(.hover):hover{cursor:none}.overlay.hover,.overlay.state-ready:focus-within,.overlay.state-ready:not(.playing){opacity:1}.overlay.state-loading,.overlay.state-error{opacity:1;transition:opacity 1s}.overlay.state-ready.auto{opacity:0}.button{width:16px;position:absolute;bottom:25px;left:14px;height:14px;transition:scale .1s ease-in,opacity .1s;background-color:transparent;border:none;background-size:100% 100%;background-repeat:no-repeat;cursor:inherit;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTEiIGhlaWdodD0iMTMiIHZpZXdCb3g9IjAgMCAxMSAxMyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMS4wMDE0VjExLjM2MTRDMCAxMi4xNTE0IDAuODcgMTIuNjMxNCAxLjU0IDEyLjIwMTRMOS42OCA3LjAyMTRDMTAuMyA2LjYzMTQgMTAuMyA1LjczMTQgOS42OCA1LjMzMTRMMS41NCAwLjE2MTQwNUMwLjg3IC0wLjI2ODU5NiAwIDAuMjExNDA1IDAgMS4wMDE0WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==)}.playing .play-button{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxMiAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIgMEMxLjQ2OTU3IDAgMC45NjA4NTkgMC4yMTA3MTQgMC41ODU3ODYgMC41ODU3ODZDMC4yMTA3MTQgMC45NjA4NTkgMCAxLjQ2OTU3IDAgMlYxMkMwIDEyLjUzMDQgMC4yMTA3MTQgMTMuMDM5MSAwLjU4NTc4NiAxMy40MTQyQzAuOTYwODU5IDEzLjc4OTMgMS40Njk1NyAxNCAyIDE0QzIuNTMwNDMgMTQgMy4wMzkxNCAxMy43ODkzIDMuNDE0MjEgMTMuNDE0MkMzLjc4OTI5IDEzLjAzOTEgNCAxMi41MzA0IDQgMTJWMkM0IDEuNDY5NTcgMy43ODkyOSAwLjk2MDg1OSAzLjQxNDIxIDAuNTg1Nzg2QzMuMDM5MTQgMC4yMTA3MTQgMi41MzA0MyAwIDIgMFpNMTAgMEM5LjQ2OTU3IDAgOC45NjA4NiAwLjIxMDcxNCA4LjU4NTc5IDAuNTg1Nzg2QzguMjEwNzEgMC45NjA4NTkgOCAxLjQ2OTU3IDggMlYxMkM4IDEyLjUzMDQgOC4yMTA3MSAxMy4wMzkxIDguNTg1NzkgMTMuNDE0MkM4Ljk2MDg2IDEzLjc4OTMgOS40Njk1NyAxNCAxMCAxNEMxMC41MzA0IDE0IDExLjAzOTEgMTMuNzg5MyAxMS40MTQyIDEzLjQxNDJDMTEuNzg5MyAxMy4wMzkxIDEyIDEyLjUzMDQgMTIgMTJWMkMxMiAxLjQ2OTU3IDExLjc4OTMgMC45NjA4NTkgMTEuNDE0MiAwLjU4NTc4NkMxMS4wMzkxIDAuMjEwNzE0IDEwLjUzMDQgMCAxMCAwWiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==)}.auto .play-button{display:none}.current-time{position:absolute;left:44px;bottom:25px;color:#fff;font-family:Arial,sans-serif;font-size:14px;line-height:14px}.canvas{width:100%;display:block;opacity:0;transition:opacity .1s}.canvas.state-ready{opacity:1}.message{font-family:JetBrains Mono,sans-serif;text-align:center;font-size:20px;padding:8px 16px;margin:16px;border-radius:4px;color:#fff9;background-color:#000000de}.loader{width:50%;max-width:96px;display:none;rotate:-90deg;animation:stroke 2s cubic-bezier(.5,0,.5,1) infinite,rotate 2s linear infinite}@keyframes stroke{0%{stroke-dasharray:5.6548667765px 50.8938009883px;stroke-dashoffset:2.8274333882px}50%{stroke-dasharray:50.8938009883px 5.6548667765px;stroke-dashoffset:-2.8274333882px}to{stroke-dasharray:5.6548667765px 50.8938009883px;stroke-dashoffset:-53.7212343766px}}@keyframes rotate{0%{rotate:-110deg}to{rotate:250deg}}
|
|
9
|
+
`,
|
|
10
|
+
k = `<div class="overlay" part="overlay">
|
|
11
|
+
<div class="controls">
|
|
12
|
+
<button
|
|
13
|
+
part="play-button"
|
|
14
|
+
title="Play / Pause"
|
|
15
|
+
class="button play-button ready"
|
|
16
|
+
tabindex="0"
|
|
17
|
+
></button>
|
|
18
|
+
<!-- New button to the right -->
|
|
19
|
+
<span class="current-time" part="current-time">0:00 / 0:00</span>
|
|
20
|
+
<div class="timeline-container">
|
|
21
|
+
<input
|
|
22
|
+
type="range"
|
|
23
|
+
class="timeline"
|
|
24
|
+
value="0"
|
|
25
|
+
min="0"
|
|
26
|
+
max="100"
|
|
27
|
+
step="1"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
13
31
|
<div part="message" class="message error">
|
|
14
32
|
An error occurred while loading the animation.
|
|
15
33
|
</div>
|
|
@@ -20,165 +38,267 @@ const f = `.initial{display:none}.state-initial .initial{display:block}.loading{
|
|
|
20
38
|
stroke="#ffffff"
|
|
21
39
|
stroke-width="2"
|
|
22
40
|
fill="transparent"
|
|
23
|
-
>
|
|
24
|
-
<circle cx="12" cy="12" r="9" />
|
|
25
|
-
</svg>
|
|
41
|
+
></svg>
|
|
26
42
|
</div>
|
|
27
|
-
`,
|
|
28
|
-
|
|
43
|
+
`,
|
|
44
|
+
f = `<style>${v}</style>${k}`,
|
|
45
|
+
d = 'revideo-player';
|
|
46
|
+
class x extends HTMLElement {
|
|
29
47
|
constructor() {
|
|
30
48
|
super();
|
|
31
|
-
e(this,
|
|
32
|
-
e(this,
|
|
33
|
-
e(this,
|
|
34
|
-
e(this,
|
|
35
|
-
e(this,
|
|
36
|
-
e(this,
|
|
37
|
-
e(this,
|
|
38
|
-
e(this,
|
|
39
|
-
e(this,
|
|
40
|
-
e(this,
|
|
41
|
-
e(this,
|
|
42
|
-
e(this,
|
|
43
|
-
e(this,
|
|
44
|
-
e(this,
|
|
45
|
-
e(this,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
e(this, 'root');
|
|
50
|
+
e(this, 'canvas');
|
|
51
|
+
e(this, 'overlay');
|
|
52
|
+
e(this, 'button');
|
|
53
|
+
e(this, 'state', 'initial');
|
|
54
|
+
e(this, 'project', null);
|
|
55
|
+
e(this, 'player', null);
|
|
56
|
+
e(this, 'defaultSettings');
|
|
57
|
+
e(this, 'abortController', null);
|
|
58
|
+
e(this, 'mouseMoveId', null);
|
|
59
|
+
e(this, 'finished', !1);
|
|
60
|
+
e(this, 'playing', !1);
|
|
61
|
+
e(this, 'connected', !1);
|
|
62
|
+
e(this, 'stage', new M());
|
|
63
|
+
e(this, 'timeline');
|
|
64
|
+
e(this, 'handleTimelineChange', t => {
|
|
65
|
+
var s, o;
|
|
66
|
+
const a = t.target,
|
|
67
|
+
i = parseFloat(a.value);
|
|
68
|
+
((s = this.player) == null ? void 0 : s.playback.duration) &&
|
|
69
|
+
((o = this.player) == null || o.requestSeek(i));
|
|
49
70
|
});
|
|
50
|
-
e(this,
|
|
51
|
-
this.
|
|
71
|
+
e(this, 'handleMouseMove', () => {
|
|
72
|
+
this.mouseMoveId && clearTimeout(this.mouseMoveId),
|
|
73
|
+
this.hover && !this.playing && this.setPlaying(!0),
|
|
74
|
+
(this.mouseMoveId = window.setTimeout(() => {
|
|
75
|
+
(this.mouseMoveId = null), this.updateClass();
|
|
76
|
+
}, 2e3)),
|
|
77
|
+
this.updateClass();
|
|
52
78
|
});
|
|
53
|
-
e(this,
|
|
54
|
-
|
|
79
|
+
e(this, 'handleMouseLeave', () => {
|
|
80
|
+
this.hover && this.setPlaying(!1),
|
|
81
|
+
this.mouseMoveId &&
|
|
82
|
+
(clearTimeout(this.mouseMoveId),
|
|
83
|
+
(this.mouseMoveId = null),
|
|
84
|
+
this.updateClass());
|
|
55
85
|
});
|
|
56
|
-
e(this,
|
|
57
|
-
|
|
58
|
-
[
|
|
59
|
-
{ scale: "0.9" },
|
|
60
|
-
{
|
|
61
|
-
scale: "1",
|
|
62
|
-
easing: "ease-out"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
{ duration: 200 }
|
|
66
|
-
));
|
|
86
|
+
e(this, 'handleMouseDown', t => {
|
|
87
|
+
t.target.closest('.timeline') || t.preventDefault();
|
|
67
88
|
});
|
|
68
|
-
e(this,
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
|
|
89
|
+
e(this, 'handleClick', t => {
|
|
90
|
+
t.target.closest('.timeline') ||
|
|
91
|
+
this.auto ||
|
|
92
|
+
(this.handleMouseMove(),
|
|
93
|
+
this.setPlaying(!this.playing),
|
|
94
|
+
this.button.animate(
|
|
95
|
+
[
|
|
96
|
+
{scale: '0.9'},
|
|
97
|
+
{
|
|
98
|
+
scale: '1',
|
|
99
|
+
easing: 'ease-out',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
{duration: 200},
|
|
103
|
+
));
|
|
73
104
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
105
|
+
e(this, 'render', async () => {
|
|
106
|
+
var t;
|
|
107
|
+
if (this.player) {
|
|
108
|
+
await this.stage.render(
|
|
109
|
+
this.player.playback.currentScene,
|
|
110
|
+
this.player.playback.previousScene,
|
|
111
|
+
),
|
|
112
|
+
this.timeline.setAttribute('min', '0'),
|
|
113
|
+
this.timeline.setAttribute('step', '1'),
|
|
114
|
+
this.timeline.setAttribute(
|
|
115
|
+
'max',
|
|
116
|
+
(t = this.player) == null ? void 0 : t.playback.duration.toString(),
|
|
117
|
+
);
|
|
118
|
+
const a = this.player.status.time,
|
|
119
|
+
i = this.player.status.framesToSeconds(this.player.playback.duration);
|
|
120
|
+
if (i) {
|
|
121
|
+
const n = this.player.status.secondsToFrames(a);
|
|
122
|
+
this.timeline.value = n.toString();
|
|
123
|
+
const s = `linear-gradient(to right, rgb(180, 180, 180) 0%, rgb(180, 180, 180) ${(100 * n) / this.player.status.secondsToFrames(i)}%, white ${(100 * n) / this.player.status.secondsToFrames(i)}%, white 100%)`;
|
|
124
|
+
(this.timeline.style.background = s),
|
|
125
|
+
this.timeline.style.setProperty('--webkit-track', s),
|
|
126
|
+
this.timeline.style.setProperty('--moz-track', s),
|
|
127
|
+
this.timeline.style.setProperty('--ms-track', s);
|
|
128
|
+
const o = this.formatTime(a),
|
|
129
|
+
c = this.formatTime(i),
|
|
130
|
+
l = this.root.querySelector('.current-time');
|
|
131
|
+
l && (l.textContent = `${o} / ${c}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
(this.root = this.attachShadow({mode: 'open'})),
|
|
136
|
+
(this.root.innerHTML = f),
|
|
137
|
+
(this.overlay = this.root.querySelector('.overlay')),
|
|
138
|
+
(this.button = this.root.querySelector('.button')),
|
|
139
|
+
(this.canvas = this.stage.finalBuffer),
|
|
140
|
+
this.canvas.classList.add('canvas'),
|
|
141
|
+
this.root.prepend(this.canvas),
|
|
142
|
+
(this.timeline = this.root.querySelector('.timeline')),
|
|
143
|
+
this.timeline.addEventListener('input', this.handleTimelineChange),
|
|
144
|
+
this.timeline.addEventListener('change', this.handleTimelineChange),
|
|
145
|
+
this.button.addEventListener('click', this.handleClick),
|
|
146
|
+
this.button.addEventListener('mousedown', this.handleMouseDown),
|
|
147
|
+
this.overlay.addEventListener('click', this.handleClick),
|
|
148
|
+
this.overlay.addEventListener('mousemove', this.handleMouseMove),
|
|
149
|
+
this.overlay.addEventListener('mouseleave', this.handleMouseLeave),
|
|
150
|
+
this.overlay.addEventListener('mousedown', this.handleMouseDown),
|
|
151
|
+
this.setState(
|
|
152
|
+
'initial',
|
|
153
|
+
/* Initial */
|
|
154
|
+
);
|
|
78
155
|
}
|
|
79
156
|
static get observedAttributes() {
|
|
80
|
-
return [
|
|
157
|
+
return ['src', 'quality', 'width', 'height', 'auto', 'variables'];
|
|
81
158
|
}
|
|
82
159
|
get auto() {
|
|
83
|
-
return !!this.getAttribute(
|
|
160
|
+
return !!this.getAttribute('auto');
|
|
84
161
|
}
|
|
85
162
|
get hover() {
|
|
86
|
-
return this.getAttribute(
|
|
163
|
+
return this.getAttribute('auto') === 'hover';
|
|
87
164
|
}
|
|
88
165
|
get quality() {
|
|
89
|
-
const t = this.getAttribute(
|
|
166
|
+
const t = this.getAttribute('quality');
|
|
90
167
|
return t ? parseFloat(t) : this.defaultSettings.resolutionScale;
|
|
91
168
|
}
|
|
92
169
|
get width() {
|
|
93
|
-
const t = this.getAttribute(
|
|
170
|
+
const t = this.getAttribute('width');
|
|
94
171
|
return t ? parseFloat(t) : this.defaultSettings.size.width;
|
|
95
172
|
}
|
|
96
173
|
get height() {
|
|
97
|
-
const t = this.getAttribute(
|
|
174
|
+
const t = this.getAttribute('height');
|
|
98
175
|
return t ? parseFloat(t) : this.defaultSettings.size.height;
|
|
99
176
|
}
|
|
100
177
|
get variables() {
|
|
101
178
|
try {
|
|
102
|
-
const t = this.getAttribute(
|
|
179
|
+
const t = this.getAttribute('variables');
|
|
103
180
|
return t ? JSON.parse(t) : {};
|
|
104
181
|
} catch {
|
|
105
|
-
return
|
|
182
|
+
return (
|
|
183
|
+
this.project.logger.warn('Project variables could not be parsed.'), {}
|
|
184
|
+
);
|
|
106
185
|
}
|
|
107
186
|
}
|
|
108
187
|
setState(t) {
|
|
109
|
-
this.state = t, this.setPlaying(this.playing);
|
|
188
|
+
(this.state = t), this.setPlaying(this.playing);
|
|
110
189
|
}
|
|
111
190
|
setPlaying(t) {
|
|
112
191
|
var a, i;
|
|
113
|
-
this.state ===
|
|
192
|
+
this.state === 'ready' && (t || (this.auto && !this.hover))
|
|
193
|
+
? ((a = this.player) == null || a.togglePlayback(!0), (this.playing = !0))
|
|
194
|
+
: ((i = this.player) == null || i.togglePlayback(!1),
|
|
195
|
+
(this.playing = !1)),
|
|
196
|
+
this.updateClass();
|
|
114
197
|
}
|
|
115
198
|
updateClass() {
|
|
116
|
-
this.overlay.className = `overlay state-${this.state}
|
|
199
|
+
(this.overlay.className = `overlay state-${this.state}`),
|
|
200
|
+
(this.canvas.className = `canvas state-${this.state}`),
|
|
201
|
+
this.overlay.classList.toggle('playing', this.playing),
|
|
202
|
+
this.overlay.classList.toggle('auto', this.auto),
|
|
203
|
+
this.overlay.classList.toggle('hover', this.mouseMoveId !== null),
|
|
204
|
+
this.connected &&
|
|
205
|
+
(this.mouseMoveId !== null || !this.playing
|
|
206
|
+
? (this.dataset.overlay = '')
|
|
207
|
+
: delete this.dataset.overlay);
|
|
117
208
|
}
|
|
118
209
|
async updateSource(t) {
|
|
119
|
-
var
|
|
210
|
+
var n, s, o, c;
|
|
120
211
|
this.setState(
|
|
121
|
-
|
|
212
|
+
'initial',
|
|
122
213
|
/* Initial */
|
|
123
|
-
),
|
|
214
|
+
),
|
|
215
|
+
(n = this.abortController) == null || n.abort(),
|
|
216
|
+
(this.abortController = new AbortController());
|
|
124
217
|
let a;
|
|
125
218
|
try {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
)
|
|
219
|
+
const l = import(
|
|
220
|
+
/* webpackIgnore: true */
|
|
221
|
+
/* @vite-ignore */
|
|
222
|
+
t
|
|
223
|
+
),
|
|
224
|
+
u = new Promise(g => setTimeout(g, 200));
|
|
225
|
+
await Promise.any([u, l]),
|
|
226
|
+
this.setState(
|
|
227
|
+
'loading',
|
|
228
|
+
/* Loading */
|
|
229
|
+
),
|
|
230
|
+
(a = (await l).default);
|
|
231
|
+
} catch (l) {
|
|
232
|
+
console.error(l),
|
|
233
|
+
this.setState(
|
|
234
|
+
'error',
|
|
235
|
+
/* Error */
|
|
236
|
+
);
|
|
140
237
|
return;
|
|
141
238
|
}
|
|
142
239
|
this.defaultSettings = a.meta.getFullRenderingSettings();
|
|
143
|
-
const i = new
|
|
144
|
-
i.setVariables(this.variables),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
240
|
+
const i = new m(a);
|
|
241
|
+
i.setVariables(this.variables),
|
|
242
|
+
(this.finished = !1),
|
|
243
|
+
(s = this.player) == null || s.onRender.unsubscribe(this.render),
|
|
244
|
+
(o = this.player) == null || o.togglePlayback(!1),
|
|
245
|
+
(c = this.player) == null || c.deactivate(),
|
|
246
|
+
(this.project = a),
|
|
247
|
+
(this.player = i),
|
|
248
|
+
this.updateSettings(),
|
|
249
|
+
this.player.onRender.subscribe(this.render),
|
|
250
|
+
this.player.togglePlayback(this.playing),
|
|
251
|
+
this.setState(
|
|
252
|
+
'ready',
|
|
253
|
+
/* Ready */
|
|
254
|
+
);
|
|
148
255
|
}
|
|
149
256
|
attributeChangedCallback(t, a, i) {
|
|
150
|
-
var
|
|
257
|
+
var n, s;
|
|
151
258
|
switch (t) {
|
|
152
|
-
case
|
|
259
|
+
case 'auto':
|
|
153
260
|
this.setPlaying(this.playing);
|
|
154
261
|
break;
|
|
155
|
-
case
|
|
262
|
+
case 'src':
|
|
156
263
|
this.updateSource(i);
|
|
157
264
|
break;
|
|
158
|
-
case
|
|
159
|
-
case
|
|
160
|
-
case
|
|
265
|
+
case 'quality':
|
|
266
|
+
case 'width':
|
|
267
|
+
case 'height':
|
|
161
268
|
this.updateSettings();
|
|
162
269
|
break;
|
|
163
|
-
case
|
|
164
|
-
(
|
|
270
|
+
case 'variables':
|
|
271
|
+
(n = this.player) == null || n.setVariables(this.variables),
|
|
272
|
+
(s = this.player) == null ||
|
|
273
|
+
s.requestSeek(this.player.playback.frame);
|
|
165
274
|
}
|
|
166
275
|
}
|
|
167
276
|
disconnectedCallback() {
|
|
168
277
|
var t, a;
|
|
169
|
-
this.connected = !1
|
|
278
|
+
(this.connected = !1),
|
|
279
|
+
(t = this.player) == null || t.deactivate(),
|
|
280
|
+
(a = this.player) == null || a.onRender.unsubscribe(this.render);
|
|
170
281
|
}
|
|
171
282
|
connectedCallback() {
|
|
172
283
|
var t, a;
|
|
173
|
-
this.connected = !0
|
|
284
|
+
(this.connected = !0),
|
|
285
|
+
(t = this.player) == null || t.activate(),
|
|
286
|
+
(a = this.player) == null || a.onRender.subscribe(this.render);
|
|
174
287
|
}
|
|
175
288
|
updateSettings() {
|
|
176
289
|
const t = {
|
|
177
290
|
...this.defaultSettings,
|
|
178
|
-
size: new
|
|
179
|
-
resolutionScale: this.quality
|
|
291
|
+
size: new b(this.width, this.height),
|
|
292
|
+
resolutionScale: this.quality,
|
|
180
293
|
};
|
|
181
294
|
this.stage.configure(t), this.player.configure(t);
|
|
182
295
|
}
|
|
296
|
+
formatTime(t) {
|
|
297
|
+
const a = Math.floor(t / 60),
|
|
298
|
+
i = Math.floor(t % 60),
|
|
299
|
+
n = a.toString().padStart(2, '0'),
|
|
300
|
+
s = i.toString().padStart(2, '0');
|
|
301
|
+
return `${n}:${s}`;
|
|
302
|
+
}
|
|
183
303
|
}
|
|
184
|
-
customElements.get(
|
|
304
|
+
customElements.get(d) || customElements.define(d, x);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revideo/player",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4-alpha.894+1d33331",
|
|
4
4
|
"description": "A custom element for displaying animations made with revideo",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "types/main.d.ts",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"types"
|
|
23
23
|
],
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@revideo/core": "^0.2.
|
|
25
|
+
"@revideo/core": "^0.2.4-alpha.894+1d33331",
|
|
26
26
|
"sass": "^1.58.0",
|
|
27
27
|
"terser": "^5.16.1"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1d33331ab697434bac6acb926243f641e4106b18"
|
|
30
30
|
}
|