mirror of https://github.com/OpenVidu/openvidu.git
openvidu-testapp: differ between final and non-final transcription events
parent
96132553ae
commit
f16eefa9df
|
@ -76,10 +76,14 @@ mat-expansion-panel {
|
||||||
margin-right: 0 !important;
|
margin-right: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.room-event {
|
.RoomEvent {
|
||||||
background: #beefd5 !important;
|
background: #beefd5 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.RoomEvent-InterimTranscription {
|
||||||
|
background: #ffbf83 !important;
|
||||||
|
}
|
||||||
|
|
||||||
mat-expansion-panel-header {
|
mat-expansion-panel-header {
|
||||||
font-size: 10.5px !important;
|
font-size: 10.5px !important;
|
||||||
padding: 0 7px 0 9px !important;
|
padding: 0 7px 0 9px !important;
|
||||||
|
|
|
@ -73,8 +73,7 @@
|
||||||
<div class="event-list-flex">
|
<div class="event-list-flex">
|
||||||
<div class="event-list scroll-custom">
|
<div class="event-list scroll-custom">
|
||||||
<mat-accordion [attr.id]="'room-events-' + room.localParticipant.identity">
|
<mat-accordion [attr.id]="'room-events-' + room.localParticipant.identity">
|
||||||
<mat-expansion-panel *ngFor="let event of events"
|
<mat-expansion-panel *ngFor="let event of events" [ngClass]="event.eventCategory">
|
||||||
[ngClass]="event.eventCategory === 'RoomEvent' ? 'room-event' : (event.eventCategory === 'ParticipantEvent' ? 'participant-event' : 'track-event')">
|
|
||||||
<mat-expansion-panel-header
|
<mat-expansion-panel-header
|
||||||
[ngClass]="event.eventType + '-' + room.localParticipant.identity"
|
[ngClass]="event.eventType + '-' + room.localParticipant.identity"
|
||||||
[collapsedHeight]="'20px'" [expandedHeight]="'20px'">
|
[collapsedHeight]="'20px'" [expandedHeight]="'20px'">
|
||||||
|
|
|
@ -32,7 +32,6 @@ import {
|
||||||
Track,
|
Track,
|
||||||
TrackPublication,
|
TrackPublication,
|
||||||
TrackPublishOptions,
|
TrackPublishOptions,
|
||||||
TranscriptionSegment,
|
|
||||||
} from 'livekit-client';
|
} from 'livekit-client';
|
||||||
import { ParticipantPermission } from 'livekit-server-sdk';
|
import { ParticipantPermission } from 'livekit-server-sdk';
|
||||||
import {
|
import {
|
||||||
|
@ -1030,16 +1029,17 @@ export class OpenviduInstanceComponent {
|
||||||
const message = await reader.readAll();
|
const message = await reader.readAll();
|
||||||
const isFinal =
|
const isFinal =
|
||||||
reader.info.attributes!['lk.transcription_final'] === 'true';
|
reader.info.attributes!['lk.transcription_final'] === 'true';
|
||||||
if (isFinal) {
|
|
||||||
this.updateEventList(
|
this.updateEventList(
|
||||||
RoomEvent.TranscriptionReceived,
|
isFinal
|
||||||
|
? ('finalTranscription' as any)
|
||||||
|
: ('interimTranscription' as any),
|
||||||
{ participant: participantInfo.identity, message },
|
{ participant: participantInfo.identity, message },
|
||||||
`${participantInfo.identity} ${
|
`${participantInfo.identity} ${
|
||||||
isFinal ? 'said' : 'is saying'
|
isFinal ? 'said' : 'is saying'
|
||||||
}: ${message}`
|
}: ${message}`,
|
||||||
|
isFinal ? 'RoomEvent' : 'RoomEvent-InterimTranscription'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1048,11 +1048,12 @@ export class OpenviduInstanceComponent {
|
||||||
updateEventList(
|
updateEventList(
|
||||||
eventType: RoomEvent,
|
eventType: RoomEvent,
|
||||||
eventContent: any,
|
eventContent: any,
|
||||||
eventDescription: string
|
eventDescription: string,
|
||||||
|
eventCategory = 'RoomEvent'
|
||||||
) {
|
) {
|
||||||
const event: TestAppEvent = {
|
const event: TestAppEvent = {
|
||||||
eventType,
|
eventType,
|
||||||
eventCategory: 'RoomEvent',
|
eventCategory: eventCategory as any,
|
||||||
eventContent,
|
eventContent,
|
||||||
eventDescription,
|
eventDescription,
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,11 +70,11 @@ mat-expansion-panel {
|
||||||
margin-right: 0 !important;
|
margin-right: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.participant-event {
|
.ParticipantEvent {
|
||||||
background: #d0ebf1 !important;
|
background: #d0ebf1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.track-event {
|
.TrackEvent {
|
||||||
background: #ede3bb !important;
|
background: #ede3bb !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<div class="event-list scroll-custom">
|
<div class="event-list scroll-custom">
|
||||||
<mat-accordion [attr.id]="index + '-participant-events-' + participant.identity">
|
<mat-accordion [attr.id]="index + '-participant-events-' + participant.identity">
|
||||||
<mat-expansion-panel *ngFor="let event of events"
|
<mat-expansion-panel *ngFor="let event of events"
|
||||||
[ngClass]="event.eventCategory === 'ParticipantEvent' ? 'participant-event' : 'track-event'">
|
[ngClass]="event.eventCategory">
|
||||||
<mat-expansion-panel-header [ngClass]="event.eventType + '-' + participant.identity"
|
<mat-expansion-panel-header [ngClass]="event.eventType + '-' + participant.identity"
|
||||||
[collapsedHeight]="'20px'" [expandedHeight]="'20px'">
|
[collapsedHeight]="'20px'" [expandedHeight]="'20px'">
|
||||||
{{event.eventType}}
|
{{event.eventType}}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Subject } from 'rxjs';
|
||||||
|
|
||||||
export interface TestAppEvent {
|
export interface TestAppEvent {
|
||||||
eventType: RoomEvent | ParticipantEvent | TrackEvent;
|
eventType: RoomEvent | ParticipantEvent | TrackEvent;
|
||||||
eventCategory: 'RoomEvent' | 'ParticipantEvent' | 'TrackEvent';
|
eventCategory: 'RoomEvent' | 'RoomEvent-InterimTranscription' | 'ParticipantEvent' | 'TrackEvent';
|
||||||
eventContent: any;
|
eventContent: any;
|
||||||
eventDescription: string;
|
eventDescription: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,15 +41,19 @@ ul {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.room-event .mat-expansion-panel-body {
|
.RoomEvent .mat-expansion-panel-body {
|
||||||
border-color: #beefd5;
|
border-color: #beefd5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.participant-event .mat-expansion-panel-body {
|
.RoomEvent-InterimTranscription .mat-expansion-panel-body {
|
||||||
|
border-color: #ffbf83;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ParticipantEvent .mat-expansion-panel-body {
|
||||||
border-color: #d0ebf1;
|
border-color: #d0ebf1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.track-event .mat-expansion-panel-body {
|
.TrackEvent .mat-expansion-panel-body {
|
||||||
border-color: #ede3bb;
|
border-color: #ede3bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue