Watch Together: alle User haben Stream-Kontrolle, Dailymotion-Support, YouTube-Qualitätswahl
- Host-Only-Beschränkung für play/pause/resume/seek/skip entfernt — alle Raum-Mitglieder können jetzt die Wiedergabe steuern - Dailymotion-Videos können jetzt abgespielt werden (postMessage API, iframe-basiert) - YouTube-Videoqualität einstellbar (Standard: 1080p, wird in localStorage gespeichert) - Queue-Items sind für alle User klickbar - "Gesehene entfernen"-Button für alle sichtbar Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7abd5551d0
commit
253a249fc7
3 changed files with 154 additions and 64 deletions
|
|
@ -364,10 +364,6 @@ async function handleMessage(client: WtClient, msg: any): Promise<void> {
|
|||
if (!client.roomId) return;
|
||||
const room = rooms.get(client.roomId);
|
||||
if (!room) return;
|
||||
if (room.hostId !== client.id) {
|
||||
sendTo(client, { type: 'error', code: 'NOT_HOST', message: 'Nur der Host kann die Wiedergabe steuern.' });
|
||||
return;
|
||||
}
|
||||
|
||||
const index = msg.index != null ? Number(msg.index) : undefined;
|
||||
if (index !== undefined) {
|
||||
|
|
@ -403,10 +399,6 @@ async function handleMessage(client: WtClient, msg: any): Promise<void> {
|
|||
if (!client.roomId) return;
|
||||
const room = rooms.get(client.roomId);
|
||||
if (!room) return;
|
||||
if (room.hostId !== client.id) {
|
||||
sendTo(client, { type: 'error', code: 'NOT_HOST', message: 'Nur der Host kann die Wiedergabe steuern.' });
|
||||
return;
|
||||
}
|
||||
// Calculate drift before pausing
|
||||
room.currentTime = room.currentTime + (room.playing ? (Date.now() - room.lastSyncAt) / 1000 : 0);
|
||||
room.playing = false;
|
||||
|
|
@ -420,10 +412,6 @@ async function handleMessage(client: WtClient, msg: any): Promise<void> {
|
|||
if (!client.roomId) return;
|
||||
const room = rooms.get(client.roomId);
|
||||
if (!room) return;
|
||||
if (room.hostId !== client.id) {
|
||||
sendTo(client, { type: 'error', code: 'NOT_HOST', message: 'Nur der Host kann die Wiedergabe steuern.' });
|
||||
return;
|
||||
}
|
||||
room.playing = true;
|
||||
room.lastSyncAt = Date.now();
|
||||
sendToRoom(room.id, getPlaybackState(room));
|
||||
|
|
@ -435,10 +423,6 @@ async function handleMessage(client: WtClient, msg: any): Promise<void> {
|
|||
if (!client.roomId) return;
|
||||
const room = rooms.get(client.roomId);
|
||||
if (!room) return;
|
||||
if (room.hostId !== client.id) {
|
||||
sendTo(client, { type: 'error', code: 'NOT_HOST', message: 'Nur der Host kann die Wiedergabe steuern.' });
|
||||
return;
|
||||
}
|
||||
room.currentTime = Number(msg.time) || 0;
|
||||
room.lastSyncAt = Date.now();
|
||||
sendToRoom(room.id, getPlaybackState(room));
|
||||
|
|
@ -449,10 +433,6 @@ async function handleMessage(client: WtClient, msg: any): Promise<void> {
|
|||
if (!client.roomId) return;
|
||||
const room = rooms.get(client.roomId);
|
||||
if (!room) return;
|
||||
if (room.hostId !== client.id) {
|
||||
sendTo(client, { type: 'error', code: 'NOT_HOST', message: 'Nur der Host kann die Wiedergabe steuern.' });
|
||||
return;
|
||||
}
|
||||
// Mark current video as watched in queue
|
||||
if (room.currentVideo) {
|
||||
const currentItem = room.queue.find(q => q.url === room.currentVideo!.url);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue