Watch Together: Embed-Fehlerbehandlung, klickbare Queue, Video-Titel

- YouTube onError Handler: Erkennt Error 101/150 (Embedding deaktiviert),
  zeigt Fehlermeldung + "Auf YouTube oeffnen" Link, auto-skip nach 3s
- Queue-Items klickbar fuer Host (play_video mit Index)
- Video-Titel werden via noembed.com oEmbed API geholt
- Server-Endpoint: GET /api/watch-together/video-info?url=...
- "Hinzufuegen" Button zeigt Ladezustand waehrend Titel-Fetch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-03-07 11:19:59 +01:00
parent e4895a792c
commit 09813b626f
7 changed files with 4967 additions and 4838 deletions

View file

@ -470,6 +470,27 @@ const watchTogetherPlugin: Plugin = {
res.json({ rooms: getRoomList() });
});
// Fetch video title via noembed.com (CORS-friendly oEmbed proxy)
app.get('/api/watch-together/video-info', async (req, res) => {
const url = String(req.query.url || '');
if (!url) {
res.json({ title: '' });
return;
}
try {
const response = await fetch(`https://noembed.com/embed?url=${encodeURIComponent(url)}`);
if (response.ok) {
const data = await response.json() as Record<string, any>;
if (data.title) {
res.json({ title: data.title, provider: data.provider_name || '' });
return;
}
}
} catch { /* ignore fetch errors */ }
// Fallback: return empty title (frontend will use URL)
res.json({ title: '' });
});
// Beacon cleanup endpoint — called via navigator.sendBeacon() on page unload
app.post('/api/watch-together/disconnect', (req, res) => {
let body = '';