mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-24 20:13:00 +03:00
Fix transcription button highlight (#7222)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
parent
33e086adec
commit
1095493fa7
@ -393,7 +393,7 @@ lk.on(RoomEvent.Connected, () => {
|
|||||||
sendMessage({ type: 'connect', value: true })
|
sendMessage({ type: 'connect', value: true })
|
||||||
isCurrentInstanceConnected.set(true)
|
isCurrentInstanceConnected.set(true)
|
||||||
isRecording.set(lk.isRecording)
|
isRecording.set(lk.isRecording)
|
||||||
initRoomMetadata(lk.metadata)
|
void initRoomMetadata(lk.metadata)
|
||||||
Analytics.handleEvent(LoveEvents.ConnectedToRoom)
|
Analytics.handleEvent(LoveEvents.ConnectedToRoom)
|
||||||
})
|
})
|
||||||
lk.on(RoomEvent.Disconnected, () => {
|
lk.on(RoomEvent.Disconnected, () => {
|
||||||
@ -403,7 +403,7 @@ lk.on(RoomEvent.Disconnected, () => {
|
|||||||
Analytics.handleEvent(LoveEvents.DisconnectedFromRoom)
|
Analytics.handleEvent(LoveEvents.DisconnectedFromRoom)
|
||||||
})
|
})
|
||||||
|
|
||||||
function initRoomMetadata (metadata: string | undefined): void {
|
async function initRoomMetadata (metadata: string | undefined): Promise<void> {
|
||||||
let data: RoomMetadata
|
let data: RoomMetadata
|
||||||
try {
|
try {
|
||||||
data = metadata == null || metadata === '' ? {} : JSON.parse(metadata)
|
data = metadata == null || metadata === '' ? {} : JSON.parse(metadata)
|
||||||
@ -420,11 +420,11 @@ function initRoomMetadata (metadata: string | undefined): void {
|
|||||||
(data.transcription == null || data.transcription === TranscriptionStatus.Idle) &&
|
(data.transcription == null || data.transcription === TranscriptionStatus.Idle) &&
|
||||||
room?.startWithTranscription === true
|
room?.startWithTranscription === true
|
||||||
) {
|
) {
|
||||||
void startTranscription(room)
|
await startTranscription(room)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get(isRecordingAvailable) && data.recording == null && room?.startWithRecording === true) {
|
if (data.recording == null && room?.startWithRecording === true) {
|
||||||
void record(room)
|
await record(room)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,12 +115,8 @@ export class LoveController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async connect (request: ConnectMeetingRequest): Promise<void> {
|
async connect (request: ConnectMeetingRequest): Promise<void> {
|
||||||
if (this.connectedRooms.has(request.roomId)) return
|
|
||||||
|
|
||||||
this.roomSidById.set(request.roomId, request.roomSid)
|
|
||||||
this.connectedRooms.add(request.roomId)
|
|
||||||
|
|
||||||
const room = await this.getRoom(request.roomId)
|
const room = await this.getRoom(request.roomId)
|
||||||
|
|
||||||
if (room === undefined) {
|
if (room === undefined) {
|
||||||
this.ctx.error('Room not found', request)
|
this.ctx.error('Room not found', request)
|
||||||
this.roomSidById.delete(request.roomId)
|
this.roomSidById.delete(request.roomId)
|
||||||
@ -128,22 +124,23 @@ export class LoveController {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.roomSidById.set(request.roomId, request.roomSid)
|
||||||
|
this.connectedRooms.add(request.roomId)
|
||||||
|
|
||||||
this.ctx.info('Connecting', { room: room.name, roomId: room._id })
|
this.ctx.info('Connecting', { room: room.name, roomId: room._id })
|
||||||
|
|
||||||
if (request.transcription) {
|
if (request.transcription) {
|
||||||
const roomTokenName = getTokenRoomName(this.workspace, room.name, room._id)
|
await this.requestTranscription(room, request.language)
|
||||||
const isTranscriptionStarted = await startTranscription(this.token, roomTokenName, room.name, request.language)
|
|
||||||
|
|
||||||
if (!isTranscriptionStarted) {
|
|
||||||
this.roomSidById.delete(request.roomId)
|
|
||||||
this.connectedRooms.delete(request.roomId)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.createAiParticipant(room)
|
await this.createAiParticipant(room)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async requestTranscription (room: Room, language: RoomLanguage): Promise<void> {
|
||||||
|
const roomTokenName = getTokenRoomName(this.workspace, room.name, room._id)
|
||||||
|
await startTranscription(this.token, roomTokenName, room.name, language)
|
||||||
|
}
|
||||||
|
|
||||||
async disconnect (roomId: Ref<Room>): Promise<void> {
|
async disconnect (roomId: Ref<Room>): Promise<void> {
|
||||||
this.ctx.info('Disconnecting', { roomId })
|
this.ctx.info('Disconnecting', { roomId })
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user