Skip to content

Commit

Permalink
fix: added transcription initialized state
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 committed May 21, 2024
1 parent 4d6a53d commit f8d4aa0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/hms-video-store/src/interfaces/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export interface HLSVariant {
Transcription related details
*/
export enum HMSTranscriptionState {
INITIALISED = 'initialised',
STARTED = 'started',
STOPPED = 'stopped',
FAILED = 'failed',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export enum HMSStreamingState {
}

export enum HMSTranscriptionState {
INITIALISED = 'initialised',
STARTED = 'started',
STOPPED = 'stopped',
FAILED = 'failed',
Expand Down
4 changes: 2 additions & 2 deletions packages/hms-video-store/src/reactive-store/HMSSDKActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,11 +701,11 @@ export class HMSSDKActions<T extends HMSGenericTypes = { sessionStore: Record<st
await this.sdk.stopHLSStreaming(params);
}

async startTranscription(params?: sdkTypes.TranscriptionConfig) {
async startTranscription(params: sdkTypes.TranscriptionConfig) {
await this.sdk.startTranscription(params);
}

async stopTranscription(params?: sdkTypes.TranscriptionConfig): Promise<void> {
async stopTranscription(params: sdkTypes.TranscriptionConfig): Promise<void> {
await this.sdk.stopTranscription(params);
}

Expand Down
11 changes: 4 additions & 7 deletions packages/hms-video-store/src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1013,27 +1013,24 @@ export class HMSSdk implements HMSInterface {
await this.transport?.signal.stopHLSStreaming();
}

async startTranscription(params?: TranscriptionConfig) {
async startTranscription(params: TranscriptionConfig) {
if (!this.localPeer) {
throw ErrorFactory.GenericErrors.NotConnected(
HMSAction.VALIDATION,
'No local peer present, cannot start HLS streaming',
'No local peer present, cannot start transcriptions',
);
}
if (!params) {
throw ErrorFactory.GenericErrors.Signalling(HMSAction.VALIDATION, 'No mode is passed to start the transcription');
}
const transcriptionParams: StartTranscriptionRequestParams = {
mode: params.mode,
};
await this.transport?.signal.startTranscription(transcriptionParams);
}

async stopTranscription(params?: TranscriptionConfig) {
async stopTranscription(params: TranscriptionConfig) {
if (!this.localPeer) {
throw ErrorFactory.GenericErrors.NotConnected(
HMSAction.VALIDATION,
'No local peer present, cannot stop HLS streaming',
'No local peer present, cannot stop transcriptions',
);
}
if (!params) {
Expand Down

0 comments on commit f8d4aa0

Please sign in to comment.