@revideo/player 0.2.4-alpha.894 → 0.2.4-alpha.895
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 +98 -179
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
var p = Object.defineProperty;
|
|
2
|
-
var y = (h, r, t) =>
|
|
3
|
-
|
|
4
|
-
|
|
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';
|
|
2
|
+
var y = (h, r, t) => r in h ? p(h, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[r] = t;
|
|
3
|
+
var e = (h, r, t) => (y(h, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
|
+
import { Stage as M, Player as m, Vector2 as b } from "@revideo/core";
|
|
8
5
|
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">
|
|
6
|
+
`, k = `<div class="overlay" part="overlay">
|
|
11
7
|
<div class="controls">
|
|
12
8
|
<button
|
|
13
9
|
part="play-button"
|
|
@@ -40,264 +36,187 @@ const v = `.initial{display:none}.state-initial .initial{display:block}.loading{
|
|
|
40
36
|
fill="transparent"
|
|
41
37
|
></svg>
|
|
42
38
|
</div>
|
|
43
|
-
`,
|
|
44
|
-
f = `<style>${v}</style>${k}`,
|
|
45
|
-
d = 'revideo-player';
|
|
39
|
+
`, f = `<style>${v}</style>${k}`, d = "revideo-player";
|
|
46
40
|
class x extends HTMLElement {
|
|
47
41
|
constructor() {
|
|
48
42
|
super();
|
|
49
|
-
e(this,
|
|
50
|
-
e(this,
|
|
51
|
-
e(this,
|
|
52
|
-
e(this,
|
|
53
|
-
e(this,
|
|
54
|
-
e(this,
|
|
55
|
-
e(this,
|
|
56
|
-
e(this,
|
|
57
|
-
e(this,
|
|
58
|
-
e(this,
|
|
59
|
-
e(this,
|
|
60
|
-
e(this,
|
|
61
|
-
e(this,
|
|
62
|
-
e(this,
|
|
63
|
-
e(this,
|
|
64
|
-
e(this,
|
|
43
|
+
e(this, "root");
|
|
44
|
+
e(this, "canvas");
|
|
45
|
+
e(this, "overlay");
|
|
46
|
+
e(this, "button");
|
|
47
|
+
e(this, "state", "initial");
|
|
48
|
+
e(this, "project", null);
|
|
49
|
+
e(this, "player", null);
|
|
50
|
+
e(this, "defaultSettings");
|
|
51
|
+
e(this, "abortController", null);
|
|
52
|
+
e(this, "mouseMoveId", null);
|
|
53
|
+
e(this, "finished", !1);
|
|
54
|
+
e(this, "playing", !1);
|
|
55
|
+
e(this, "connected", !1);
|
|
56
|
+
e(this, "stage", new M());
|
|
57
|
+
e(this, "timeline");
|
|
58
|
+
e(this, "handleTimelineChange", (t) => {
|
|
65
59
|
var s, o;
|
|
66
|
-
const a = t.target,
|
|
67
|
-
|
|
68
|
-
((s = this.player) == null ? void 0 : s.playback.duration) &&
|
|
69
|
-
((o = this.player) == null || o.requestSeek(i));
|
|
60
|
+
const a = t.target, i = parseFloat(a.value);
|
|
61
|
+
((s = this.player) == null ? void 0 : s.playback.duration) && ((o = this.player) == null || o.requestSeek(i));
|
|
70
62
|
});
|
|
71
|
-
e(this,
|
|
72
|
-
this.mouseMoveId && clearTimeout(this.mouseMoveId),
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
(this.mouseMoveId = null), this.updateClass();
|
|
76
|
-
}, 2e3)),
|
|
77
|
-
this.updateClass();
|
|
63
|
+
e(this, "handleMouseMove", () => {
|
|
64
|
+
this.mouseMoveId && clearTimeout(this.mouseMoveId), this.hover && !this.playing && this.setPlaying(!0), this.mouseMoveId = window.setTimeout(() => {
|
|
65
|
+
this.mouseMoveId = null, this.updateClass();
|
|
66
|
+
}, 2e3), this.updateClass();
|
|
78
67
|
});
|
|
79
|
-
e(this,
|
|
80
|
-
this.hover && this.setPlaying(!1),
|
|
81
|
-
this.mouseMoveId &&
|
|
82
|
-
(clearTimeout(this.mouseMoveId),
|
|
83
|
-
(this.mouseMoveId = null),
|
|
84
|
-
this.updateClass());
|
|
68
|
+
e(this, "handleMouseLeave", () => {
|
|
69
|
+
this.hover && this.setPlaying(!1), this.mouseMoveId && (clearTimeout(this.mouseMoveId), this.mouseMoveId = null, this.updateClass());
|
|
85
70
|
});
|
|
86
|
-
e(this,
|
|
87
|
-
t.target.closest(
|
|
71
|
+
e(this, "handleMouseDown", (t) => {
|
|
72
|
+
t.target.closest(".timeline") || t.preventDefault();
|
|
88
73
|
});
|
|
89
|
-
e(this,
|
|
90
|
-
t.target.closest(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
{duration: 200},
|
|
103
|
-
));
|
|
74
|
+
e(this, "handleClick", (t) => {
|
|
75
|
+
t.target.closest(".timeline") || this.auto || (this.handleMouseMove(), this.setPlaying(!this.playing), this.button.animate(
|
|
76
|
+
[
|
|
77
|
+
{ scale: "0.9" },
|
|
78
|
+
{
|
|
79
|
+
scale: "1",
|
|
80
|
+
easing: "ease-out"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
{ duration: 200 }
|
|
84
|
+
));
|
|
104
85
|
});
|
|
105
|
-
e(this,
|
|
86
|
+
e(this, "render", async () => {
|
|
106
87
|
var t;
|
|
107
88
|
if (this.player) {
|
|
108
89
|
await this.stage.render(
|
|
109
90
|
this.player.playback.currentScene,
|
|
110
|
-
this.player.playback.previousScene
|
|
111
|
-
),
|
|
112
|
-
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const a = this.player.status.time,
|
|
119
|
-
i = this.player.status.framesToSeconds(this.player.playback.duration);
|
|
91
|
+
this.player.playback.previousScene
|
|
92
|
+
), this.timeline.setAttribute("min", "0"), this.timeline.setAttribute("step", "1"), this.timeline.setAttribute(
|
|
93
|
+
"max",
|
|
94
|
+
(t = this.player) == null ? void 0 : t.playback.duration.toString()
|
|
95
|
+
);
|
|
96
|
+
const a = this.player.status.time, i = this.player.status.framesToSeconds(
|
|
97
|
+
this.player.playback.duration
|
|
98
|
+
);
|
|
120
99
|
if (i) {
|
|
121
100
|
const n = this.player.status.secondsToFrames(a);
|
|
122
101
|
this.timeline.value = n.toString();
|
|
123
|
-
const s = `linear-gradient(to right, rgb(180, 180, 180) 0%, rgb(180, 180, 180) ${
|
|
124
|
-
|
|
125
|
-
|
|
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');
|
|
102
|
+
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%)`;
|
|
103
|
+
this.timeline.style.background = s, this.timeline.style.setProperty("--webkit-track", s), this.timeline.style.setProperty("--moz-track", s), this.timeline.style.setProperty("--ms-track", s);
|
|
104
|
+
const o = this.formatTime(a), c = this.formatTime(i), l = this.root.querySelector(".current-time");
|
|
131
105
|
l && (l.textContent = `${o} / ${c}`);
|
|
132
106
|
}
|
|
133
107
|
}
|
|
134
108
|
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
);
|
|
109
|
+
this.root = this.attachShadow({ mode: "open" }), this.root.innerHTML = f, this.overlay = this.root.querySelector(".overlay"), this.button = this.root.querySelector(".button"), this.canvas = this.stage.finalBuffer, this.canvas.classList.add("canvas"), this.root.prepend(this.canvas), this.timeline = this.root.querySelector(".timeline"), this.timeline.addEventListener("input", this.handleTimelineChange), this.timeline.addEventListener("change", this.handleTimelineChange), this.button.addEventListener("click", this.handleClick), this.button.addEventListener("mousedown", this.handleMouseDown), this.overlay.addEventListener("click", this.handleClick), this.overlay.addEventListener("mousemove", this.handleMouseMove), this.overlay.addEventListener("mouseleave", this.handleMouseLeave), this.overlay.addEventListener("mousedown", this.handleMouseDown), this.setState(
|
|
110
|
+
"initial"
|
|
111
|
+
/* Initial */
|
|
112
|
+
);
|
|
155
113
|
}
|
|
156
114
|
static get observedAttributes() {
|
|
157
|
-
return [
|
|
115
|
+
return ["src", "quality", "width", "height", "auto", "variables"];
|
|
158
116
|
}
|
|
159
117
|
get auto() {
|
|
160
|
-
return !!this.getAttribute(
|
|
118
|
+
return !!this.getAttribute("auto");
|
|
161
119
|
}
|
|
162
120
|
get hover() {
|
|
163
|
-
return this.getAttribute(
|
|
121
|
+
return this.getAttribute("auto") === "hover";
|
|
164
122
|
}
|
|
165
123
|
get quality() {
|
|
166
|
-
const t = this.getAttribute(
|
|
124
|
+
const t = this.getAttribute("quality");
|
|
167
125
|
return t ? parseFloat(t) : this.defaultSettings.resolutionScale;
|
|
168
126
|
}
|
|
169
127
|
get width() {
|
|
170
|
-
const t = this.getAttribute(
|
|
128
|
+
const t = this.getAttribute("width");
|
|
171
129
|
return t ? parseFloat(t) : this.defaultSettings.size.width;
|
|
172
130
|
}
|
|
173
131
|
get height() {
|
|
174
|
-
const t = this.getAttribute(
|
|
132
|
+
const t = this.getAttribute("height");
|
|
175
133
|
return t ? parseFloat(t) : this.defaultSettings.size.height;
|
|
176
134
|
}
|
|
177
135
|
get variables() {
|
|
178
136
|
try {
|
|
179
|
-
const t = this.getAttribute(
|
|
137
|
+
const t = this.getAttribute("variables");
|
|
180
138
|
return t ? JSON.parse(t) : {};
|
|
181
139
|
} catch {
|
|
182
|
-
return (
|
|
183
|
-
this.project.logger.warn('Project variables could not be parsed.'), {}
|
|
184
|
-
);
|
|
140
|
+
return this.project.logger.warn("Project variables could not be parsed."), {};
|
|
185
141
|
}
|
|
186
142
|
}
|
|
187
143
|
setState(t) {
|
|
188
|
-
|
|
144
|
+
this.state = t, this.setPlaying(this.playing);
|
|
189
145
|
}
|
|
190
146
|
setPlaying(t) {
|
|
191
147
|
var a, i;
|
|
192
|
-
this.state ===
|
|
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();
|
|
148
|
+
this.state === "ready" && (t || this.auto && !this.hover) ? ((a = this.player) == null || a.togglePlayback(!0), this.playing = !0) : ((i = this.player) == null || i.togglePlayback(!1), this.playing = !1), this.updateClass();
|
|
197
149
|
}
|
|
198
150
|
updateClass() {
|
|
199
|
-
|
|
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);
|
|
151
|
+
this.overlay.className = `overlay state-${this.state}`, this.canvas.className = `canvas state-${this.state}`, this.overlay.classList.toggle("playing", this.playing), this.overlay.classList.toggle("auto", this.auto), this.overlay.classList.toggle("hover", this.mouseMoveId !== null), this.connected && (this.mouseMoveId !== null || !this.playing ? this.dataset.overlay = "" : delete this.dataset.overlay);
|
|
208
152
|
}
|
|
209
153
|
async updateSource(t) {
|
|
210
154
|
var n, s, o, c;
|
|
211
155
|
this.setState(
|
|
212
|
-
|
|
156
|
+
"initial"
|
|
213
157
|
/* Initial */
|
|
214
|
-
),
|
|
215
|
-
(n = this.abortController) == null || n.abort(),
|
|
216
|
-
(this.abortController = new AbortController());
|
|
158
|
+
), (n = this.abortController) == null || n.abort(), this.abortController = new AbortController();
|
|
217
159
|
let a;
|
|
218
160
|
try {
|
|
219
161
|
const l = import(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
/* Loading */
|
|
229
|
-
),
|
|
230
|
-
(a = (await l).default);
|
|
162
|
+
/* webpackIgnore: true */
|
|
163
|
+
/* @vite-ignore */
|
|
164
|
+
t
|
|
165
|
+
), u = new Promise((g) => setTimeout(g, 200));
|
|
166
|
+
await Promise.any([u, l]), this.setState(
|
|
167
|
+
"loading"
|
|
168
|
+
/* Loading */
|
|
169
|
+
), a = (await l).default;
|
|
231
170
|
} catch (l) {
|
|
232
|
-
console.error(l),
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
);
|
|
171
|
+
console.error(l), this.setState(
|
|
172
|
+
"error"
|
|
173
|
+
/* Error */
|
|
174
|
+
);
|
|
237
175
|
return;
|
|
238
176
|
}
|
|
239
177
|
this.defaultSettings = a.meta.getFullRenderingSettings();
|
|
240
178
|
const i = new m(a);
|
|
241
|
-
i.setVariables(this.variables),
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
);
|
|
179
|
+
i.setVariables(this.variables), this.finished = !1, (s = this.player) == null || s.onRender.unsubscribe(this.render), (o = this.player) == null || o.togglePlayback(!1), (c = this.player) == null || c.deactivate(), this.project = a, this.player = i, this.updateSettings(), this.player.onRender.subscribe(this.render), this.player.togglePlayback(this.playing), this.setState(
|
|
180
|
+
"ready"
|
|
181
|
+
/* Ready */
|
|
182
|
+
);
|
|
255
183
|
}
|
|
256
184
|
attributeChangedCallback(t, a, i) {
|
|
257
185
|
var n, s;
|
|
258
186
|
switch (t) {
|
|
259
|
-
case
|
|
187
|
+
case "auto":
|
|
260
188
|
this.setPlaying(this.playing);
|
|
261
189
|
break;
|
|
262
|
-
case
|
|
190
|
+
case "src":
|
|
263
191
|
this.updateSource(i);
|
|
264
192
|
break;
|
|
265
|
-
case
|
|
266
|
-
case
|
|
267
|
-
case
|
|
193
|
+
case "quality":
|
|
194
|
+
case "width":
|
|
195
|
+
case "height":
|
|
268
196
|
this.updateSettings();
|
|
269
197
|
break;
|
|
270
|
-
case
|
|
271
|
-
(n = this.player) == null || n.setVariables(this.variables),
|
|
272
|
-
(s = this.player) == null ||
|
|
273
|
-
s.requestSeek(this.player.playback.frame);
|
|
198
|
+
case "variables":
|
|
199
|
+
(n = this.player) == null || n.setVariables(this.variables), (s = this.player) == null || s.requestSeek(this.player.playback.frame);
|
|
274
200
|
}
|
|
275
201
|
}
|
|
276
202
|
disconnectedCallback() {
|
|
277
203
|
var t, a;
|
|
278
|
-
|
|
279
|
-
(t = this.player) == null || t.deactivate(),
|
|
280
|
-
(a = this.player) == null || a.onRender.unsubscribe(this.render);
|
|
204
|
+
this.connected = !1, (t = this.player) == null || t.deactivate(), (a = this.player) == null || a.onRender.unsubscribe(this.render);
|
|
281
205
|
}
|
|
282
206
|
connectedCallback() {
|
|
283
207
|
var t, a;
|
|
284
|
-
|
|
285
|
-
(t = this.player) == null || t.activate(),
|
|
286
|
-
(a = this.player) == null || a.onRender.subscribe(this.render);
|
|
208
|
+
this.connected = !0, (t = this.player) == null || t.activate(), (a = this.player) == null || a.onRender.subscribe(this.render);
|
|
287
209
|
}
|
|
288
210
|
updateSettings() {
|
|
289
211
|
const t = {
|
|
290
212
|
...this.defaultSettings,
|
|
291
213
|
size: new b(this.width, this.height),
|
|
292
|
-
resolutionScale: this.quality
|
|
214
|
+
resolutionScale: this.quality
|
|
293
215
|
};
|
|
294
216
|
this.stage.configure(t), this.player.configure(t);
|
|
295
217
|
}
|
|
296
218
|
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');
|
|
219
|
+
const a = Math.floor(t / 60), i = Math.floor(t % 60), n = a.toString().padStart(2, "0"), s = i.toString().padStart(2, "0");
|
|
301
220
|
return `${n}:${s}`;
|
|
302
221
|
}
|
|
303
222
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revideo/player",
|
|
3
|
-
"version": "0.2.4-alpha.
|
|
3
|
+
"version": "0.2.4-alpha.895+a5ad28d",
|
|
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.4-alpha.
|
|
25
|
+
"@revideo/core": "^0.2.4-alpha.895+a5ad28d",
|
|
26
26
|
"sass": "^1.58.0",
|
|
27
27
|
"terser": "^5.16.1"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "a5ad28d7272c96d7f695aec645d188eac4720c0d"
|
|
30
30
|
}
|