Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Decoder07 committed Jun 21, 2024
1 parent 95c3afc commit 0faae3c
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/hms_room_kit/lib/src/meeting/meeting_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ class MeetingStore extends ChangeNotifier
}
}
}
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
///[HMSTranscriptionListenerMethod] contains method for `HMSTranscriptionListener`
enum HMSTranscriptionListenerMethod { onTranscripts, unknown }

extension HMSTranscriptionListenerMethodValues
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
///[HMSTranscriptionMode] is an enum class that defines the transcription mode of the meeting.
enum HMSTranscriptionMode { caption, live, unknown }

extension HMSTranscriptionModeValues on HMSTranscriptionMode {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
///[HMSTranscriptionState] is an enum class which defines the state of the transcription
enum HMSTranscriptionState { started, stopped, initialized, failed, unknown }

extension HMSTranscriptionStateValues on HMSTranscriptionState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:hmssdk_flutter/hmssdk_flutter.dart';
import 'package:hmssdk_flutter/src/enum/hms_hls_playback_event_method.dart';
import 'package:hmssdk_flutter/src/enum/hms_key_change_listener_method.dart';
import 'package:hmssdk_flutter/src/enum/hms_logs_update_listener.dart';
import 'package:hmssdk_flutter/src/enum/hms_trancription_listener_method.dart';
import 'package:hmssdk_flutter/src/enum/hms_transcription_listener_method.dart';

///PlatformMethodResponse contains all the responses sent back from the platform
///
Expand Down
17 changes: 17 additions & 0 deletions packages/hmssdk_flutter/lib/src/model/transcription.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
//Project imports
import 'package:hmssdk_flutter/src/enum/hms_transcription_mode.dart';
import 'package:hmssdk_flutter/src/enum/hms_transcription_state.dart';
import 'package:hmssdk_flutter/src/model/hms_date_extension.dart';

///[Transcription] is a class which includes the properties of a transcription
class Transcription {
///[error] is the error object which contains the error code and message if any error occurs.
final TranscriptionError? error;

///[startedAt] is the time when the transcription started.
final DateTime? startedAt;

///[stoppedAt] is the time when the transcription stopped.
final DateTime? stoppedAt;

///[updatedAt] is the time when the transcription was last updated.
final DateTime? updatedAt;

///[state] is an enum of type [HMSTranscriptionState] which tells the state of the transcription.
final HMSTranscriptionState? state;

///[mode] is an enum of type [HMSTranscriptionMode] which tells the mode of the transcription.
final HMSTranscriptionMode? mode;

Transcription(
Expand Down Expand Up @@ -43,8 +56,12 @@ class Transcription {
}
}

///[TranscriptionError] is a class which includes the properties of an error in transcription
class TranscriptionError {
///[code] is the error code.
final int? code;

///[message] is the error message.
final String? message;

TranscriptionError({required this.code, required this.message});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
//Project imports
import 'package:hmssdk_flutter/src/model/transcription/hms_transcription.dart';

///[HMSTranscriptListener] is the listener interface which listens to the transcription of the meeting.
///
///Implement this listener in your class to get the transcription of the meeting.
abstract class HMSTranscriptListener {
///[onTranscripts] is called when the transcription is received.
void onTranscripts({required List<HMSTranscription> transcriptions}) {}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
///[HMSTranscription] is a class which is used to represent a transcription.
class HMSTranscription {
final int start;
final int end;

///[transcript] is the text of the transcription.
final String transcript;

///[peerId] is the id of the speaker.
final String peerId;

///[peerName] is the name of the speaker.
final String? peerName;

///[isFinal] is a boolean which tells if the transcription is final or not.
final bool isFinal;

HMSTranscription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
//Project imports
import 'package:hmssdk_flutter/hmssdk_flutter.dart';
import 'package:hmssdk_flutter/src/service/platform_service.dart';

///[HMSTranscriptionController] is used to control transcription in the meeting.
abstract class HMSTranscriptionController {
///[addListener] is used to add a listener to get the transcription of the meeting.
/// **parameters**:
///
/// **listener** - [HMSTranscriptListener] instance to be attached
/// Learn more about [addListener] [here](https://www.100ms.live/docs/flutter/v2/how-to-guides/extend-capabilities/live-captions#step-1-add-hmstranscriptlistener-to-the-class-to-start-getting-transcriptions)
static void addListener({required HMSTranscriptListener listener}) {
PlatformService.addTranscriptListener(listener);
PlatformService.invokeMethod(PlatformMethod.addTranscriptListener);
}

///[removeListener] is used to remove the listener that was previously added.
///Learn more about [removeListener] [here](https://www.100ms.live/docs/flutter/v2/how-to-guides/extend-capabilities/live-captions#step-3-to-stop-getting-transcriptions-remove-hmstranscriptlistener)
static void removeListener() {
PlatformService.removeTranscriptListener();
PlatformService.invokeMethod(PlatformMethod.removeTranscriptListener);
}

///[startTranscription] is used to start the transcription of the meeting.
///
/// **parameters**:
///
/// **mode** - [HMSTranscriptionMode] to start the transcription in the meeting. Default is [HMSTranscriptionMode.caption]
///
/// Refer [startTranscription](https://www.100ms.live/docs/flutter/v2/how-to-guides/extend-capabilities/live-captions#start-transcription)
static Future<HMSException?> startTranscription(
{HMSTranscriptionMode mode = HMSTranscriptionMode.caption}) async {
var result = await PlatformService.invokeMethod(
Expand All @@ -25,6 +41,13 @@ abstract class HMSTranscriptionController {
}
}

///[stopTranscription] is used to stop the transcription of the meeting.
///
/// **parameters**:
///
/// **mode** - [HMSTranscriptionMode] to stop the transcription in the meeting. Default is [HMSTranscriptionMode.caption]
///
/// Refer [stopTranscription](https://www.100ms.live/docs/flutter/v2/how-to-guides/extend-capabilities/live-captions#stop-transcription)
static Future<HMSException?> stopTranscription(
{HMSTranscriptionMode mode = HMSTranscriptionMode.caption}) async {
var result = await PlatformService.invokeMethod(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
//Project imports
import 'package:hmssdk_flutter/src/enum/hms_transcription_mode.dart';

///[HMSTranscriptionPermission] contains the permission of the user for transcription.
class HMSTranscriptionPermission {
///[mode] is the transcription mode of the meeting.
final HMSTranscriptionMode mode;

///[admin] is a boolean value that defines if the user has admin permission for transcription.
///i.e permissions to start/stop the transcription.
final bool admin;

HMSTranscriptionPermission({required this.mode, required this.admin});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:hmssdk_flutter/hmssdk_flutter.dart';
import 'package:hmssdk_flutter/src/enum/hms_hls_playback_event_method.dart';
import 'package:hmssdk_flutter/src/enum/hms_key_change_listener_method.dart';
import 'package:hmssdk_flutter/src/enum/hms_logs_update_listener.dart';
import 'package:hmssdk_flutter/src/enum/hms_trancription_listener_method.dart';
import 'package:hmssdk_flutter/src/enum/hms_transcription_listener_method.dart';
import 'package:hmssdk_flutter/src/model/hms_key_change_observer.dart';
import 'package:hmssdk_flutter/src/model/platform_method_response.dart';

Expand Down Expand Up @@ -56,6 +56,7 @@ abstract class PlatformService {
static const EventChannel _whiteboardEventChannel =
const EventChannel("whiteboard_event_channel");

///used to get transcription events
static const EventChannel _transcriptionEventChannel =
const EventChannel("transcription_event_channel");

Expand Down

0 comments on commit 0faae3c

Please sign in to comment.