Medienweiche: Probe-Saal ueber LiveKit (Kamera, Mikro und Spiel gleichzeitig)
Neuplan Stufe 8, Schritte 1-3. server/medienweiche.js gibt kurzlebige Schluessel aus (HS256, 4 h, Senden nur Regie, je Verbindung eigene Kennung) und reicht NUR den Signalweg /workspace/lk/rtc an LiveKit (127.0.0.1:7880) durch; /twirp bleibt zu. Schluessel in server/.livekit.json (640, gitignore), ohne Datei: "nicht eingerichtet". workspace/probesaal.html + probesaal.js: parallel zum Saal, der unveraendert bleibt; Link im Foyer. livekit-client 2.23.0 (Apache-2.0) in assets/js/fremd mit HERKUNFT.txt; pruef-struktur prueft Herkunft, Pruefsumme und Uebertragungsgroesse (Gegenprobe). Ende-zu-Ende ueber den echten Server: Regie sendet Kamera+Mikro+Spiel+ Spielton gleichzeitig, Zuschauer empfaengt beide Bilder und beide Tonspuren, Handy ok, Zuschauer darf nicht senden (insufficient permissions). Nebenbei: Tippziele Foyer-Link und DogTag-Sprunglink, pruef-dogtag-seite (Satz umformuliert), pruef-reaktion-stil (6 Knoepfe). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -284,3 +284,7 @@
|
||||
}
|
||||
@media (pointer: coarse) { .dtu-knopf, .dtu-suche input, .dtu-auswahl select { min-height: 44px; } }
|
||||
@media (prefers-reduced-motion: reduce) { .dtu-schalter__knopf { transition: none; } }
|
||||
|
||||
/* Tippziel (03.11.2026, pruef-handy): Der Sprunglink war 21 Punkte hoch –
|
||||
am Finger zu klein. Volle 44 Punkte, ohne dass er größer AUSSIEHT. */
|
||||
#dtp-zur-uebersicht:not([hidden]) { display: inline-flex; align-items: center; min-height: 44px; }
|
||||
|
||||
@@ -958,3 +958,6 @@ body[data-raum="foyer"][data-stand="live"] .kopf-zeile { --ton: #d8404a;
|
||||
mehr findet. */
|
||||
.sg-teil .btn.saal-zocken { margin-top: 4px; }
|
||||
.saal-zocken[hidden] { display: none; }
|
||||
|
||||
/* Der Link zum Probe-Saal (03.11.2026): leise, aber ein volles Tippziel. */
|
||||
.foyer-probe { align-self: center; min-height: 44px; margin-top: 4px; }
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/* =====================================================================
|
||||
PROBE-SAAL (03.11.2026) – ruhig, dunkel, im Hausstil (Bausteine aus
|
||||
stil-bausteine.css). Bewegt wird nichts außer dem Bild selbst.
|
||||
===================================================================== */
|
||||
body.sg { margin: 0; min-height: 100vh; }
|
||||
.probe { max-width: 1280px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
|
||||
.probe__kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
|
||||
.probe__titel { flex: 1 1 240px; min-width: 0; }
|
||||
.probe__titel h1 { margin: 0; font-size: 1.3rem; }
|
||||
.probe__titel p { margin: 2px 0 0; font-size: .9rem; color: var(--c-leise); }
|
||||
.probe__buehne { position: relative; }
|
||||
.probe__leinwand {
|
||||
position: relative; aspect-ratio: 16 / 9; width: 100%;
|
||||
background: #05060c; border: 1px solid var(--c-kante); border-radius: 14px; overflow: hidden;
|
||||
}
|
||||
.probe__leer {
|
||||
position: absolute; inset: 0; display: grid; place-items: center; margin: 0;
|
||||
padding: 24px; text-align: center; color: var(--c-leise); font-size: .95rem;
|
||||
}
|
||||
.probe__leer[hidden] { display: none; }
|
||||
.probe__haupt, .probe__haupt .probe__kachel { position: absolute; inset: 0; }
|
||||
.probe__haupt video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
|
||||
/* Die kleinen Kacheln (Kamera beim Zocken): unten rechts im EIGENEN Bild –
|
||||
kein YouTube-Player, also erlaubt. */
|
||||
.probe__klein {
|
||||
position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px;
|
||||
width: min(42%, 340px); flex-direction: column;
|
||||
}
|
||||
.probe__klein .probe__kachel {
|
||||
position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
|
||||
border: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 12px 30px -12px #000;
|
||||
}
|
||||
.probe__klein video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
|
||||
.probe__name {
|
||||
position: absolute; left: 6px; bottom: 6px; padding: 1px 8px; border-radius: 6px;
|
||||
background: rgba(6, 6, 12, .78); font-size: .75rem; font-weight: 600; color: var(--c-text);
|
||||
}
|
||||
.probe__ton { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); }
|
||||
.probe__ton[hidden] { display: none; }
|
||||
.probe__regie, .probe__werte {
|
||||
background: var(--c-karte); border: 1px solid var(--c-kante); border-radius: 14px; padding: 14px 16px;
|
||||
}
|
||||
.probe__regie[hidden] { display: none; }
|
||||
.probe__regie h2, .probe__werte h2 { margin: 0 0 10px; font-size: 1rem; }
|
||||
.probe__knoepfe { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.probe__knoepfe .btn[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--c-blau); }
|
||||
.probe__hinweis { margin: 10px 0 0; font-size: .85rem; color: var(--c-leise); }
|
||||
#werte { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 16px; }
|
||||
#werte div { display: grid; gap: 2px; }
|
||||
#werte dt { font-size: .75rem; color: var(--c-leise); }
|
||||
#werte dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
|
||||
@media (max-width: 600px) {
|
||||
.probe { padding: 10px; }
|
||||
.probe__klein { width: 46%; right: 8px; bottom: 8px; }
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# Fremde Bibliotheken – unverändert übernommen, nie von Hand bearbeiten.
|
||||
# pruef-struktur prüft je Zeile: Datei da, Prüfsumme gleich, übertragen ≤ 200 KB.
|
||||
# Datei | Paket@Version | Lizenz | Quelle | sha256
|
||||
livekit-client-2.23.0.js | [email protected] (dist/livekit-client.umd.js) | Apache-2.0 | https://registry.npmjs.org/livekit-client/-/livekit-client-2.23.0.tgz | fb646f2260d84f91238d0a2dc10726c456631d6a26c7cafc43cfee5959b4d31d
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,175 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
@@ -188,6 +188,10 @@
|
||||
Satz. Ein Maschinenwort auf dem Bildschirm ist kein Fehler des
|
||||
Servers -- es ist einer der Oberflaeche, und pruef-meldungen
|
||||
zaehlt sie mit. */
|
||||
medienweiche_nicht_eingerichtet:
|
||||
'Die Medienweiche ist auf diesem Server noch nicht eingerichtet.',
|
||||
medienweiche_nicht_erreichbar:
|
||||
'Die Medienweiche antwortet gerade nicht – bitte gleich noch einmal.',
|
||||
nur_host:
|
||||
'Das dürfen nur DogFather und die rechte Hand – '
|
||||
+ 'die beiden führen die Sendung.',
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
/* =====================================================================
|
||||
DER PROBE-SAAL (03.11.2026) – siehe probesaal.html und server/medienweiche.js
|
||||
|
||||
Empfangen tut jeder, der angemeldet ist; senden nur, wem der Server es
|
||||
im Schlüssel erlaubt (die Regie). Kamera und Spielbild werden SELBST mit
|
||||
getUserMedia / getDisplayMedia geholt und dann an LiveKit übergeben –
|
||||
so bestimmen wir Auflösung, Bildrate und Inhaltshinweis, und die
|
||||
Kamera-Richtlinie des Servers (pruef-kamera-richtlinie) sieht, dass
|
||||
diese Seite die Kamera braucht.
|
||||
|
||||
`window.__probe` trägt die Messwerte für die Prüfung: verbunden?,
|
||||
wie viele Bilder kommen an, wie viele werden gesendet.
|
||||
===================================================================== */
|
||||
(() => {
|
||||
'use strict';
|
||||
const $ = (id) => document.getElementById(id);
|
||||
const probe = $('probe');
|
||||
const zustand = { verbunden: false, empfangen: 0, gesendet: [], fehler: '' };
|
||||
window.__probe = zustand;
|
||||
|
||||
function lage(text, art) {
|
||||
$('lage').textContent = text;
|
||||
$('lage').className = 'badge' + (art ? ` b-${art}` : '');
|
||||
}
|
||||
|
||||
async function start() {
|
||||
const LK = window.LivekitClient;
|
||||
if (!LK) { lage('Bibliothek fehlt', 'live'); zustand.fehler = 'bibliothek'; return; }
|
||||
let antwort;
|
||||
try {
|
||||
antwort = await fetch('/workspace/api/reaktion/medienweiche', { credentials: 'same-origin', cache: 'no-store' });
|
||||
} catch { lage('Server nicht erreichbar', 'live'); zustand.fehler = 'netz'; return; }
|
||||
if (antwort.status === 401) { location.href = 'start.html'; return; }
|
||||
if (!antwort.ok) {
|
||||
const j = await antwort.json().catch(() => null);
|
||||
lage(j?.fehler === 'medienweiche_nicht_eingerichtet' ? 'Medienweiche nicht eingerichtet' : `Fehler ${antwort.status}`, 'warn');
|
||||
zustand.fehler = j?.fehler || String(antwort.status);
|
||||
probe.dataset.stand = 'fehler';
|
||||
return;
|
||||
}
|
||||
const z = await antwort.json();
|
||||
if (!z?.token) {
|
||||
lage('Medienweiche nicht eingerichtet', 'warn');
|
||||
zustand.fehler = z?.fehler || 'kein_schluessel';
|
||||
probe.dataset.stand = 'fehler';
|
||||
return;
|
||||
}
|
||||
const url = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.host}${z.pfad}`;
|
||||
const raum = new LK.Room({ adaptiveStream: true, dynacast: true });
|
||||
window.__raum = raum;
|
||||
|
||||
raum.on(LK.RoomEvent.TrackSubscribed, (track, pub, wer) => einhaengen(track, wer));
|
||||
raum.on(LK.RoomEvent.TrackUnsubscribed, (track) => { track.detach().forEach((e) => e.closest('.probe__kachel')?.remove() || e.remove()); zaehlen(); });
|
||||
raum.on(LK.RoomEvent.ParticipantConnected, zaehlen);
|
||||
raum.on(LK.RoomEvent.ParticipantDisconnected, zaehlen);
|
||||
raum.on(LK.RoomEvent.AudioPlaybackStatusChanged, () => { $('ton').hidden = raum.canPlaybackAudio; });
|
||||
raum.on(LK.RoomEvent.ConnectionQualityChanged, () => { $('w-verbindung').textContent = qualitaet(raum.localParticipant.connectionQuality); });
|
||||
raum.on(LK.RoomEvent.Disconnected, () => { zustand.verbunden = false; lage('getrennt – neu laden', 'warn'); });
|
||||
raum.on(LK.RoomEvent.Reconnecting, () => lage('verbindet neu …', 'warn'));
|
||||
raum.on(LK.RoomEvent.Reconnected, () => lage('verbunden', 'ok'));
|
||||
|
||||
try {
|
||||
await raum.connect(url, z.token);
|
||||
} catch (f) {
|
||||
lage('Verbindung gescheitert', 'live');
|
||||
zustand.fehler = String(f?.message || f).slice(0, 120);
|
||||
probe.dataset.stand = 'fehler';
|
||||
return;
|
||||
}
|
||||
zustand.verbunden = true;
|
||||
probe.dataset.stand = 'verbunden';
|
||||
lage('verbunden', 'ok');
|
||||
$('ton').hidden = raum.canPlaybackAudio;
|
||||
$('ton').addEventListener('click', () => raum.startAudio());
|
||||
zaehlen();
|
||||
if (z.senden) regieBauen(LK, raum);
|
||||
setInterval(() => messen(raum), 2000);
|
||||
}
|
||||
|
||||
function qualitaet(q) {
|
||||
return { excellent: 'sehr gut', good: 'gut', poor: 'schwach', lost: 'weg' }[q] || 'wird gemessen';
|
||||
}
|
||||
|
||||
function zaehlen() {
|
||||
const raum = window.__raum;
|
||||
if (!raum) return;
|
||||
const n = raum.remoteParticipants.size + 1;
|
||||
$('w-leute').textContent = String(n);
|
||||
$('zahl').hidden = false;
|
||||
$('zahl').textContent = `${n} im Probe-Saal`;
|
||||
}
|
||||
|
||||
function einhaengen(track, wer) {
|
||||
const LK = window.LivekitClient;
|
||||
if (track.kind === LK.Track.Kind.Audio) {
|
||||
const a = track.attach();
|
||||
a.hidden = true;
|
||||
document.body.append(a);
|
||||
return;
|
||||
}
|
||||
const kachel = document.createElement('div');
|
||||
kachel.className = 'probe__kachel';
|
||||
const v = track.attach();
|
||||
v.muted = true;
|
||||
v.playsInline = true;
|
||||
const name = document.createElement('span');
|
||||
name.className = 'probe__name';
|
||||
name.textContent = wer?.name || 'Regie';
|
||||
kachel.append(v, name);
|
||||
const gross = track.source === LK.Track.Source.ScreenShare || !$('haupt').querySelector('.probe__kachel');
|
||||
if (track.source === LK.Track.Source.ScreenShare) {
|
||||
/* Das Spiel ist das große Bild; eine Kamera, die schon dort stand, rückt nach klein. */
|
||||
for (const alt of $('haupt').querySelectorAll('.probe__kachel')) $('klein').append(alt);
|
||||
}
|
||||
(gross ? $('haupt') : $('klein')).append(kachel);
|
||||
$('leer').hidden = true;
|
||||
zustand.empfangen = document.querySelectorAll('#leinwand video').length;
|
||||
$('w-bilder').textContent = String(zustand.empfangen);
|
||||
}
|
||||
|
||||
function regieBauen(LK, raum) {
|
||||
$('regie').hidden = false;
|
||||
const lokal = { kamera: null, mikro: null, spiel: [] };
|
||||
const druecken = (k, an, anWort, ausWort) => { k.setAttribute('aria-pressed', String(an)); k.textContent = an ? ausWort : anWort; };
|
||||
|
||||
$('b-kamera').addEventListener('click', async () => {
|
||||
if (lokal.kamera) {
|
||||
await raum.localParticipant.unpublishTrack(lokal.kamera); lokal.kamera.stop(); lokal.kamera = null;
|
||||
return druecken($('b-kamera'), false, 'Kamera an', 'Kamera aus');
|
||||
}
|
||||
try {
|
||||
const s = await navigator.mediaDevices.getUserMedia({ video: { width: { ideal: 1280 }, height: { ideal: 720 }, frameRate: { ideal: 30 } } });
|
||||
lokal.kamera = s.getVideoTracks()[0];
|
||||
await raum.localParticipant.publishTrack(lokal.kamera, { source: LK.Track.Source.Camera, simulcast: true, name: 'kamera' });
|
||||
druecken($('b-kamera'), true, 'Kamera an', 'Kamera aus');
|
||||
} catch (f) { lage(`Kamera: ${f?.name || f}`, 'warn'); }
|
||||
});
|
||||
|
||||
$('b-mikro').addEventListener('click', async () => {
|
||||
if (lokal.mikro) {
|
||||
await raum.localParticipant.unpublishTrack(lokal.mikro); lokal.mikro.stop(); lokal.mikro = null;
|
||||
return druecken($('b-mikro'), false, 'Mikro an', 'Mikro aus');
|
||||
}
|
||||
try {
|
||||
const s = await navigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, noiseSuppression: true } });
|
||||
lokal.mikro = s.getAudioTracks()[0];
|
||||
await raum.localParticipant.publishTrack(lokal.mikro, { source: LK.Track.Source.Microphone, name: 'mikro' });
|
||||
druecken($('b-mikro'), true, 'Mikro an', 'Mikro aus');
|
||||
} catch (f) { lage(`Mikro: ${f?.name || f}`, 'warn'); }
|
||||
});
|
||||
|
||||
$('b-spiel').addEventListener('click', async () => {
|
||||
if (lokal.spiel.length) {
|
||||
for (const t of lokal.spiel) { await raum.localParticipant.unpublishTrack(t); t.stop(); }
|
||||
lokal.spiel = [];
|
||||
return druecken($('b-spiel'), false, 'Spiel / Bildschirm teilen', 'Teilen beenden');
|
||||
}
|
||||
try {
|
||||
const s = await navigator.mediaDevices.getDisplayMedia({
|
||||
video: { frameRate: { ideal: 30, max: 60 }, width: { ideal: 1920 }, height: { ideal: 1080 } },
|
||||
audio: { echoCancellation: false, noiseSuppression: false, autoGainControl: false },
|
||||
selfBrowserSurface: 'exclude', systemAudio: 'include', surfaceSwitching: 'include',
|
||||
});
|
||||
const bild = s.getVideoTracks()[0];
|
||||
bild.contentHint = 'motion';
|
||||
await raum.localParticipant.publishTrack(bild, {
|
||||
source: LK.Track.Source.ScreenShare, name: 'spiel', simulcast: false,
|
||||
videoEncoding: { maxBitrate: 6_000_000, maxFramerate: 30 }, degradationPreference: 'maintain-framerate',
|
||||
});
|
||||
lokal.spiel = [bild];
|
||||
const ton = s.getAudioTracks()[0];
|
||||
if (ton) {
|
||||
await raum.localParticipant.publishTrack(ton, { source: LK.Track.Source.ScreenShareAudio, name: 'spielton', dtx: false, red: true });
|
||||
lokal.spiel.push(ton);
|
||||
} else {
|
||||
lage('Bild geht hinaus – aber ohne Spielton (Häkchen „Systemaudio teilen“ fehlte)', 'warn');
|
||||
}
|
||||
bild.addEventListener('ended', () => { if (lokal.spiel.length) $('b-spiel').click(); });
|
||||
druecken($('b-spiel'), true, 'Spiel / Bildschirm teilen', 'Teilen beenden');
|
||||
} catch (f) {
|
||||
if (f?.name !== 'NotAllowedError') lage(`Teilen: ${f?.name || f}`, 'warn');
|
||||
}
|
||||
});
|
||||
window.__regie = lokal;
|
||||
}
|
||||
|
||||
async function messen(raum) {
|
||||
const gesendet = [];
|
||||
for (const pub of raum.localParticipant.trackPublications.values()) {
|
||||
if (pub.track?.kind === 'video') {
|
||||
const st = pub.track.mediaStreamTrack?.getSettings?.() || {};
|
||||
gesendet.push(`${pub.source === 'screen_share' ? 'Spiel' : 'Kamera'} ${st.width || '?'}×${st.height || '?'}`);
|
||||
}
|
||||
}
|
||||
zustand.gesendet = gesendet;
|
||||
$('w-gesendet').textContent = gesendet.join(' · ') || '–';
|
||||
$('w-verbindung').textContent = qualitaet(raum.localParticipant.connectionQuality);
|
||||
zustand.empfangen = document.querySelectorAll('#leinwand video').length;
|
||||
$('w-bilder').textContent = String(zustand.empfangen);
|
||||
zaehlen();
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start);
|
||||
else start();
|
||||
})();
|
||||
Reference in New Issue
Block a user