Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(subtitles): ITranscriptMessage type. #15042

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions react/features/subtitles/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
updateTranscriptMessage
} from './actions.any';
import { notifyTranscriptionChunkReceived } from './functions';
import { ITranscriptMessage } from './types';


/**
Expand Down Expand Up @@ -188,9 +189,8 @@ function _endpointMessageReceived(store: IStore, next: Function, action: AnyActi
// message ID or adds a new transcript message if it does not
// exist in the map.
const existingMessage = state['features/subtitles']._transcriptMessages.get(transcriptMessageID);
const newTranscriptMessage: any = {
const newTranscriptMessage: ITranscriptMessage = {
clearTimeOut: existingMessage?.clearTimeOut,
language,
participant
};

Expand Down
10 changes: 2 additions & 8 deletions react/features/subtitles/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
TOGGLE_REQUESTING_SUBTITLES,
UPDATE_TRANSCRIPT_MESSAGE
} from './actionTypes';
import { ITranscriptMessage } from './types';

/**
* Default State for 'features/transcription' feature.
Expand All @@ -17,18 +18,11 @@ const defaultState = {
_language: null
};

interface ITranscriptMessage {
final: string;
participantName: string;
stable: string;
unstable: string;
}

export interface ISubtitlesState {
_displaySubtitles: boolean;
_language: string | null;
_requestingSubtitles: boolean;
_transcriptMessages: Map<string, ITranscriptMessage> | any;
_transcriptMessages: Map<string, ITranscriptMessage>;
}

/**
Expand Down
11 changes: 11 additions & 0 deletions react/features/subtitles/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export interface ITranscriptMessage {
clearTimeOut?: number;
final?: string;
participant: {
avatarUrl?: string;
id?: string;
name?: string;
};
stable?: string;
unstable?: string;
}