mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-19 08:51:37 +03:00
Readonly room name (#7441)
This commit is contained in:
parent
f265242c6f
commit
294aceffc1
@ -13,7 +13,6 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { EditBox, ModernButton } from '@hcengineering/ui'
|
||||
import { Room, isOffice, type ParticipantInfo } from '@hcengineering/love'
|
||||
import { createEventDispatcher, onMount } from 'svelte'
|
||||
@ -21,26 +20,16 @@
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
|
||||
import love from '../plugin'
|
||||
import { getRoomName, tryConnect, isConnected, leaveRoom } from '../utils'
|
||||
import { getRoomName, tryConnect, isConnected } from '../utils'
|
||||
import { infos, invites, myInfo, myRequests, selectedRoomPlace, myOffice, currentRoom } from '../stores'
|
||||
|
||||
export let object: Room
|
||||
export let readonly: boolean = false
|
||||
|
||||
const client = getClient()
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
let newName = getRoomName(object, $personByIdStore)
|
||||
$: roomName = getRoomName(object, $personByIdStore)
|
||||
let connecting = false
|
||||
|
||||
async function changeName (): Promise<void> {
|
||||
if (isOffice(object)) {
|
||||
return
|
||||
}
|
||||
|
||||
await client.diffUpdate(object, { name: newName })
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
dispatch('open', { ignoreKeys: ['name'] })
|
||||
})
|
||||
@ -107,13 +96,7 @@
|
||||
<div class="flex-row-stretch">
|
||||
<div class="row flex-grow">
|
||||
<div class="name">
|
||||
<EditBox
|
||||
disabled={readonly || isOffice(object)}
|
||||
placeholder={love.string.Room}
|
||||
on:change={changeName}
|
||||
bind:value={newName}
|
||||
focusIndex={1}
|
||||
/>
|
||||
<EditBox disabled={true} placeholder={love.string.Room} bind:value={roomName} focusIndex={1} />
|
||||
</div>
|
||||
{#if showConnectionButton(object, connecting, $isConnected, $infos, $myOffice, $currentRoom)}
|
||||
<ModernButton label={connectLabel} size="large" kind={'primary'} on:click={connect} loading={connecting} />
|
||||
|
@ -419,7 +419,7 @@ async function initRoomMetadata (metadata: string | undefined): Promise<void> {
|
||||
await startTranscription(room)
|
||||
}
|
||||
|
||||
if (get(isRecordingAvailable) && data.recording == null && room?.startWithRecording === true) {
|
||||
if (get(isRecordingAvailable) && data.recording == null && room?.startWithRecording === true && !get(isRecording)) {
|
||||
await record(room)
|
||||
}
|
||||
}
|
||||
@ -675,11 +675,7 @@ async function initMeetingMinutes (room: Room): Promise<void> {
|
||||
.toLocaleDateString('en-GB', {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: false,
|
||||
timeZone: 'UTC'
|
||||
year: 'numeric'
|
||||
})
|
||||
.replace(',', ' at')
|
||||
const _id = generateId<MeetingMinutes>()
|
||||
|
@ -79,13 +79,11 @@ function applyMetadata (data: string | undefined, stt: STT): void {
|
||||
}
|
||||
|
||||
if (metadata.transcription === TranscriptionStatus.InProgress) {
|
||||
console.log('Starting transcription', stt.name)
|
||||
stt.start()
|
||||
} else if (
|
||||
metadata.transcription === TranscriptionStatus.Completed ||
|
||||
metadata.transcription === TranscriptionStatus.Idle
|
||||
) {
|
||||
console.log('Stopping transcription', stt.name)
|
||||
stt.stop()
|
||||
}
|
||||
}
|
||||
@ -115,6 +113,7 @@ export default defineAgent({
|
||||
RoomEvent.TrackSubscribed,
|
||||
(track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => {
|
||||
if (publication.kind === TrackKind.KIND_AUDIO) {
|
||||
console.log('Subscribing to track', participant.name, publication.sid)
|
||||
stt.subscribe(track, publication, participant)
|
||||
}
|
||||
}
|
||||
@ -124,6 +123,7 @@ export default defineAgent({
|
||||
RoomEvent.TrackUnsubscribed,
|
||||
(track: RemoteTrack, publication: RemoteTrackPublication, participant: RemoteParticipant) => {
|
||||
if (publication.kind === TrackKind.KIND_AUDIO) {
|
||||
console.log('Unsubscribing from track', participant.name, publication.sid)
|
||||
stt.unsubscribe(track, publication, participant)
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,8 @@ export class STT {
|
||||
private readonly dgConnectionBySid = new Map<string, ListenLiveClient>()
|
||||
private readonly intervalBySid = new Map<string, NodeJS.Timeout>()
|
||||
|
||||
private transcriptionCount = 0
|
||||
|
||||
constructor (readonly name: string) {
|
||||
this.deepgram = createClient(config.DeepgramApiKey)
|
||||
}
|
||||
@ -70,6 +72,7 @@ export class STT {
|
||||
|
||||
start (): void {
|
||||
if (this.isInProgress) return
|
||||
console.log('Starting transcription', this.name)
|
||||
this.isInProgress = true
|
||||
|
||||
for (const sid of this.trackBySid.keys()) {
|
||||
@ -79,6 +82,7 @@ export class STT {
|
||||
|
||||
stop (): void {
|
||||
if (!this.isInProgress) return
|
||||
console.log('Stopping transcription', this.name)
|
||||
this.isInProgress = false
|
||||
for (const sid of this.trackBySid.keys()) {
|
||||
this.stopDeepgram(sid)
|
||||
@ -146,6 +150,7 @@ export class STT {
|
||||
sample_rate: stream.sampleRate,
|
||||
language: this.language ?? 'en'
|
||||
})
|
||||
console.log('Starting deepgram for track', this.name, sid)
|
||||
|
||||
const interval = setInterval(() => {
|
||||
dgConnection.keepAlive()
|
||||
@ -206,6 +211,12 @@ export class STT {
|
||||
roomName: this.name
|
||||
}
|
||||
|
||||
this.transcriptionCount++
|
||||
|
||||
if (this.transcriptionCount === 1 || this.transcriptionCount % 50 === 0) {
|
||||
console.log('Sending transcript', this.name, this.transcriptionCount)
|
||||
}
|
||||
|
||||
try {
|
||||
await fetch(`${config.PlatformUrl}/love/transcript`, {
|
||||
method: 'POST',
|
||||
|
Loading…
Reference in New Issue
Block a user