观影室增加屏幕共享
This commit is contained in:
+29
-1
@@ -6,15 +6,18 @@ export interface Room {
|
||||
description: string;
|
||||
password?: string;
|
||||
isPublic: boolean;
|
||||
roomType: RoomType;
|
||||
ownerId: string;
|
||||
ownerName: string;
|
||||
ownerToken: string; // 房主令牌,用于重连时验证身份
|
||||
memberCount: number;
|
||||
currentState: PlayState | LiveState | null;
|
||||
currentState: PlayState | LiveState | ScreenState | null;
|
||||
createdAt: number;
|
||||
lastOwnerHeartbeat: number;
|
||||
}
|
||||
|
||||
export type RoomType = 'sync' | 'screen';
|
||||
|
||||
export interface Member {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -42,6 +45,14 @@ export interface LiveState {
|
||||
channelUrl: string;
|
||||
}
|
||||
|
||||
export interface ScreenState {
|
||||
type: 'screen';
|
||||
status: 'idle' | 'sharing';
|
||||
ownerName: string;
|
||||
hasAudio?: boolean;
|
||||
startedAt?: number;
|
||||
}
|
||||
|
||||
export interface ChatMessage {
|
||||
id: string;
|
||||
userId: string;
|
||||
@@ -73,6 +84,12 @@ export interface ServerToClientEvents {
|
||||
'play:pause': () => void;
|
||||
'play:change': (state: PlayState) => void;
|
||||
'live:change': (state: LiveState) => void;
|
||||
'screen:start': (state: ScreenState) => void;
|
||||
'screen:stop': () => void;
|
||||
'screen:viewer-ready': (data: { userId: string }) => void;
|
||||
'screen:offer': (data: { userId: string; offer: RTCSessionDescriptionInit }) => void;
|
||||
'screen:answer': (data: { userId: string; answer: RTCSessionDescriptionInit }) => void;
|
||||
'screen:ice': (data: { userId: string; candidate: RTCIceCandidateInit }) => void;
|
||||
'chat:message': (message: ChatMessage) => void;
|
||||
'voice:offer': (data: { userId: string; offer: RTCSessionDescriptionInit }) => void;
|
||||
'voice:answer': (data: { userId: string; answer: RTCSessionDescriptionInit }) => void;
|
||||
@@ -90,6 +107,7 @@ export interface ClientToServerEvents {
|
||||
description: string;
|
||||
password?: string;
|
||||
isPublic: boolean;
|
||||
roomType: RoomType;
|
||||
userName: string;
|
||||
}, callback: (response: { success: boolean; room?: Room; error?: string }) => void) => void;
|
||||
|
||||
@@ -111,6 +129,16 @@ export interface ClientToServerEvents {
|
||||
'play:change': (state: PlayState) => void;
|
||||
|
||||
'live:change': (state: LiveState) => void;
|
||||
'screen:helper-register': (data: {
|
||||
roomId: string;
|
||||
ownerToken: string;
|
||||
}, callback: (response: { success: boolean; error?: string }) => void) => void;
|
||||
'screen:start': (state: ScreenState) => void;
|
||||
'screen:stop': () => void;
|
||||
'screen:viewer-ready': () => void;
|
||||
'screen:offer': (data: { targetUserId: string; offer: RTCSessionDescriptionInit }) => void;
|
||||
'screen:answer': (data: { targetUserId: string; answer: RTCSessionDescriptionInit }) => void;
|
||||
'screen:ice': (data: { targetUserId: string; candidate: RTCIceCandidateInit }) => void;
|
||||
|
||||
'chat:message': (data: { content: string; type: 'text' | 'emoji' }) => void;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user