@scarlett-player/embed 0.4.0 → 0.4.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/dist/embed.audio.js +17 -0
- package/dist/embed.audio.js.map +1 -1
- package/dist/embed.audio.umd.cjs +1 -1
- package/dist/embed.audio.umd.cjs.map +1 -1
- package/dist/embed.js +29 -5
- package/dist/embed.js.map +1 -1
- package/dist/embed.umd.cjs +1 -1
- package/dist/embed.umd.cjs.map +1 -1
- package/dist/embed.video.js +29 -5
- package/dist/embed.video.js.map +1 -1
- package/dist/embed.video.umd.cjs +1 -1
- package/dist/embed.video.umd.cjs.map +1 -1
- package/package.json +8 -8
package/dist/embed.video.js
CHANGED
|
@@ -144,6 +144,9 @@ function setupVideoEventHandlers(video, api) {
|
|
|
144
144
|
video.addEventListener(event, handler);
|
|
145
145
|
handlers.push({ event, handler });
|
|
146
146
|
};
|
|
147
|
+
addHandler("play", () => {
|
|
148
|
+
api.setState("paused", false);
|
|
149
|
+
});
|
|
147
150
|
addHandler("playing", () => {
|
|
148
151
|
api.setState("playing", true);
|
|
149
152
|
api.setState("paused", false);
|
|
@@ -608,6 +611,20 @@ function createHLSPlugin(config) {
|
|
|
608
611
|
if (!isNaN(levelIndex) && levelIndex >= 0 && levelIndex < hls.levels.length) {
|
|
609
612
|
hls.nextLevel = levelIndex;
|
|
610
613
|
api?.logger.debug(`Quality: queued switch to level ${levelIndex}`);
|
|
614
|
+
const targetLevel = hls.levels[levelIndex];
|
|
615
|
+
if (targetLevel) {
|
|
616
|
+
const label = formatLevel(targetLevel);
|
|
617
|
+
api?.setState("currentQuality", {
|
|
618
|
+
id: `level-${levelIndex}`,
|
|
619
|
+
label: `${label}...`,
|
|
620
|
+
// Ellipsis indicates switching in progress
|
|
621
|
+
width: targetLevel.width,
|
|
622
|
+
height: targetLevel.height,
|
|
623
|
+
bitrate: targetLevel.bitrate,
|
|
624
|
+
active: false
|
|
625
|
+
// Not yet active
|
|
626
|
+
});
|
|
627
|
+
}
|
|
611
628
|
}
|
|
612
629
|
}
|
|
613
630
|
});
|
|
@@ -1351,12 +1368,11 @@ var PlayButton = class {
|
|
|
1351
1368
|
const video = getVideo(this.api.container);
|
|
1352
1369
|
if (!video) return;
|
|
1353
1370
|
const ended = this.api.getState("ended");
|
|
1354
|
-
const playing = this.api.getState("playing");
|
|
1355
1371
|
if (ended) {
|
|
1356
1372
|
video.currentTime = 0;
|
|
1357
1373
|
video.play().catch(() => {
|
|
1358
1374
|
});
|
|
1359
|
-
} else if (
|
|
1375
|
+
} else if (!video.paused) {
|
|
1360
1376
|
video.pause();
|
|
1361
1377
|
} else {
|
|
1362
1378
|
video.play().catch(() => {
|
|
@@ -2171,8 +2187,9 @@ function uiPlugin(config = {}) {
|
|
|
2171
2187
|
if (containerStyle.position === "static") {
|
|
2172
2188
|
container.style.position = "relative";
|
|
2173
2189
|
}
|
|
2190
|
+
const isPlaying = api.getState("playing");
|
|
2174
2191
|
gradient = document.createElement("div");
|
|
2175
|
-
gradient.className = "sp-gradient sp-gradient--visible";
|
|
2192
|
+
gradient.className = isPlaying ? "sp-gradient" : "sp-gradient sp-gradient--visible";
|
|
2176
2193
|
container.appendChild(gradient);
|
|
2177
2194
|
bufferingIndicator = document.createElement("div");
|
|
2178
2195
|
bufferingIndicator.className = "sp-buffering";
|
|
@@ -2181,9 +2198,11 @@ function uiPlugin(config = {}) {
|
|
|
2181
2198
|
container.appendChild(bufferingIndicator);
|
|
2182
2199
|
progressBar = new ProgressBar(api);
|
|
2183
2200
|
container.appendChild(progressBar.render());
|
|
2184
|
-
|
|
2201
|
+
if (!isPlaying) {
|
|
2202
|
+
progressBar.show();
|
|
2203
|
+
}
|
|
2185
2204
|
controlBar = document.createElement("div");
|
|
2186
|
-
controlBar.className = "sp-controls sp-controls--visible";
|
|
2205
|
+
controlBar.className = isPlaying ? "sp-controls sp-controls--hidden" : "sp-controls sp-controls--visible";
|
|
2187
2206
|
controlBar.setAttribute("role", "toolbar");
|
|
2188
2207
|
controlBar.setAttribute("aria-label", "Video controls");
|
|
2189
2208
|
for (const slot of layout) {
|
|
@@ -2206,6 +2225,11 @@ function uiPlugin(config = {}) {
|
|
|
2206
2225
|
if (!container.hasAttribute("tabindex")) {
|
|
2207
2226
|
container.setAttribute("tabindex", "0");
|
|
2208
2227
|
}
|
|
2228
|
+
controlsVisible = !isPlaying;
|
|
2229
|
+
api.setState("controlsVisible", controlsVisible);
|
|
2230
|
+
if (isPlaying) {
|
|
2231
|
+
resetHideTimer();
|
|
2232
|
+
}
|
|
2209
2233
|
api.logger.debug("UI controls plugin initialized");
|
|
2210
2234
|
},
|
|
2211
2235
|
async destroy() {
|