Skip to content

Commit

Permalink
feat: 녹화 상태 check event 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
begong313 committed Dec 3, 2024
1 parent 460cb9a commit fd53780
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions apps/media/src/record/record.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,8 @@ export class RecordService {
private releasePort(port: number): void {
this.usedPorts.delete(port);
}

getIsRecording(roomId: string) {
return this.recordInfos.has(roomId);
}
}
13 changes: 9 additions & 4 deletions apps/media/src/signaling/signaling.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,27 @@ export class SignalingGateway implements OnGatewayDisconnect {
}

@SubscribeMessage(SOCKET_EVENTS.startRecord)
async recordStart(@ConnectedSocket() client: Socket, @MessageBody('roomId') roomId: string) {
async startRecord(@ConnectedSocket() client: Socket, @MessageBody('roomId') roomId: string) {
await this.recordService.startRecord(roomId, client.id);
}

@SubscribeMessage(SOCKET_EVENTS.stopRecord)
recordStop(@MessageBody('roomId') roomId: string) {
stopRecord(@MessageBody('roomId') roomId: string) {
this.recordService.stopRecord(roomId);
}

@SubscribeMessage(SOCKET_EVENTS.pauseRecord)
recordPause(@MessageBody('roomId') roomId: string) {
pauseRecord(@MessageBody('roomId') roomId: string) {
this.recordService.pauseRecord(roomId);
}

@SubscribeMessage(SOCKET_EVENTS.resumeRecord)
recordResume(@MessageBody('roomId') roomId: string) {
resumeRecord(@MessageBody('roomId') roomId: string) {
this.recordService.resumeRecord(roomId);
}
@SubscribeMessage(SOCKET_EVENTS.getIsRecording)
getIsRecording(@MessageBody('roomId') roomId: string) {
const isRecording = this.recordService.getIsRecording(roomId);
return { isRecording };
}
}
1 change: 1 addition & 0 deletions packages/mediasoup/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const SOCKET_EVENTS = {
stopRecord: 'stop-record',
pauseRecord: 'pause-record',
resumeRecord: 'resume-record',
getIsRecording: 'get-is-recording',
} as const;

export const TRANSPORT_EVENTS = {
Expand Down

0 comments on commit fd53780

Please sign in to comment.