mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 11:49:25 +00:00
Fix mute pausing videos
This commit is contained in:
@@ -302,8 +302,9 @@ body {
|
|||||||
|
|
||||||
.admin-identity {
|
.admin-identity {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 14px;
|
gap: 4px;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-actions.tight {
|
.header-actions.tight {
|
||||||
|
|||||||
@@ -961,6 +961,7 @@ function applyMediaSettings(element, asset) {
|
|||||||
}
|
}
|
||||||
const nextSpeed = asset.speed ?? 1;
|
const nextSpeed = asset.speed ?? 1;
|
||||||
const effectiveSpeed = Math.max(nextSpeed, 0.01);
|
const effectiveSpeed = Math.max(nextSpeed, 0.01);
|
||||||
|
const wasMuted = element.muted;
|
||||||
if (element.playbackRate !== effectiveSpeed) {
|
if (element.playbackRate !== effectiveSpeed) {
|
||||||
element.playbackRate = effectiveSpeed;
|
element.playbackRate = effectiveSpeed;
|
||||||
}
|
}
|
||||||
@@ -968,7 +969,19 @@ function applyMediaSettings(element, asset) {
|
|||||||
if (element.muted !== shouldMute) {
|
if (element.muted !== shouldMute) {
|
||||||
element.muted = shouldMute;
|
element.muted = shouldMute;
|
||||||
}
|
}
|
||||||
element.pause();
|
if (nextSpeed === 0) {
|
||||||
|
element.pause();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const playPromise = element.play();
|
||||||
|
if (playPromise?.catch) {
|
||||||
|
playPromise.catch(() => {
|
||||||
|
if (!shouldMute && wasMuted) {
|
||||||
|
element.muted = true;
|
||||||
|
element.play().catch(() => {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderAssetList() {
|
function renderAssetList() {
|
||||||
|
|||||||
@@ -670,6 +670,7 @@ function applyMediaSettings(element, asset) {
|
|||||||
}
|
}
|
||||||
const nextSpeed = asset.speed ?? 1;
|
const nextSpeed = asset.speed ?? 1;
|
||||||
const effectiveSpeed = Math.max(nextSpeed, 0.01);
|
const effectiveSpeed = Math.max(nextSpeed, 0.01);
|
||||||
|
const wasMuted = element.muted;
|
||||||
if (element.playbackRate !== effectiveSpeed) {
|
if (element.playbackRate !== effectiveSpeed) {
|
||||||
element.playbackRate = effectiveSpeed;
|
element.playbackRate = effectiveSpeed;
|
||||||
}
|
}
|
||||||
@@ -679,8 +680,16 @@ function applyMediaSettings(element, asset) {
|
|||||||
}
|
}
|
||||||
if (nextSpeed === 0) {
|
if (nextSpeed === 0) {
|
||||||
element.pause();
|
element.pause();
|
||||||
} else if (element.paused) {
|
} else {
|
||||||
element.play().catch(() => {});
|
const playPromise = element.play();
|
||||||
|
if (playPromise?.catch) {
|
||||||
|
playPromise.catch(() => {
|
||||||
|
if (!shouldMute && wasMuted) {
|
||||||
|
element.muted = true;
|
||||||
|
element.play().catch(() => {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,14 +14,15 @@
|
|||||||
<div class="admin-shell">
|
<div class="admin-shell">
|
||||||
<header class="admin-header">
|
<header class="admin-header">
|
||||||
<div class="admin-identity">
|
<div class="admin-identity">
|
||||||
<div class="brand-mark">IF</div>
|
<p class="eyebrow subtle">Channel</p>
|
||||||
<div>
|
<h1 th:text="${broadcaster}"></h1>
|
||||||
<p class="eyebrow subtle">Channel</p>
|
|
||||||
<h1 th:text="${broadcaster}"></h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="header-actions horizontal">
|
<div class="header-actions horizontal">
|
||||||
<a class="button ghost" th:href="@{/}">Back to dashboard</a>
|
<a class="icon-button" th:href="@{/}" title="Back to dashboard">
|
||||||
|
<i class="fa-solid fa-chevron-left" aria-hidden="true"></i>
|
||||||
|
<span class="sr-only">Back to dashboard</span>
|
||||||
|
</a>
|
||||||
|
<a class="button ghost" th:href="${'/view/' + broadcaster + '/broadcast'}" target="_blank" rel="noopener">Broadcaster view</a>
|
||||||
<form th:action="@{/logout}" method="post">
|
<form th:action="@{/logout}" method="post">
|
||||||
<button class="secondary" type="submit">Logout</button>
|
<button class="secondary" type="submit">Logout</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in New Issue
Block a user