Skip to content

Commit

Permalink
Merge pull request #1792 from 100mslive/develop
Browse files Browse the repository at this point in the history
Release-1.10.4: Develop to main
  • Loading branch information
Decoder07 authored Jul 1, 2024
2 parents c2cedce + 17ee4e4 commit 5d2be71
Show file tree
Hide file tree
Showing 58 changed files with 1,625 additions and 246 deletions.
17 changes: 17 additions & 0 deletions packages/hms_room_kit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,29 @@
| hms_room_kit | [![Pub Version](https://img.shields.io/pub/v/hms_room_kit)](https://pub.dev/packages/hms_room_kit) |
| hmssdk_flutter | [![Pub Version](https://img.shields.io/pub/v/hmssdk_flutter)](https://pub.dev/packages/hmssdk_flutter) |

## 1.1.4 - 2024-07-01

| Package | Version |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| hms_room_kit | 1.1.4 |
| hmssdk_flutter | 1.10.4 |
| hms_video_plugin | 0.0.2 |

### 🚀 Added

- Introducing live transcription options in prebuilt

Prebuilt now supports live transcription for better accessibility. Users can enable or disable live transcription from the prebuilt interface.

Uses `hmssdk_flutter` package version 1.10.4

## 1.1.3 - 2024-06-12

| Package | Version |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| hms_room_kit | 1.1.3 |
| hmssdk_flutter | 1.10.3 |
| hms_video_plugin | 0.0.1 |

### 🚀 Added

Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions packages/hms_room_kit/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,15 @@ packages:
path: ".."
relative: true
source: path
version: "1.1.3"
version: "1.1.4"
hmssdk_flutter:
dependency: transitive
description:
name: hmssdk_flutter
sha256: b1c3e2e9e50bff07831f77c948e4db46ded3b582304aa74b2019e4f8750fcfe1
sha256: c91a6409939487c5322b950cf23a5ebe3f40ab839163b06977d51545a3cceb13
url: "https://pub.dev"
source: hosted
version: "1.10.3"
version: "1.10.4"
http:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions packages/hms_room_kit/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.3
version: 1.1.4

environment:
sdk: ">=2.19.6 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand Down
19 changes: 0 additions & 19 deletions packages/hms_room_kit/ios/Runner/GeneratedPluginRegistrant.h

This file was deleted.

14 changes: 0 additions & 14 deletions packages/hms_room_kit/ios/Runner/GeneratedPluginRegistrant.m

This file was deleted.

3 changes: 3 additions & 0 deletions packages/hms_room_kit/lib/src/assets/icons/cc-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/hms_room_kit/lib/src/assets/icons/cc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/hms_room_kit/lib/src/meeting/meeting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'package:hms_room_kit/src/preview_for_role/preview_for_role_bottom_sheet.
import 'package:hms_room_kit/src/preview_for_role/preview_for_role_header.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/hms_circular_avatar.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/hms_left_room_screen.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/transcription_view.dart';

///[MeetingPage] is the main page of the meeting
///It takes the following parameters:
Expand Down Expand Up @@ -152,6 +153,10 @@ class _MeetingPageState extends State<MeetingPage> {
],
),

ChangeNotifierProvider.value(
value: _visibilityController,
child: const TranscriptionView()),

///This gets rendered when the previewForRole method is called
///This is used to show the preview for role component
Selector<
Expand Down
105 changes: 104 additions & 1 deletion packages/hms_room_kit/lib/src/meeting/meeting_store.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
///Dart imports
library;

import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
Expand Down Expand Up @@ -38,7 +39,8 @@ class MeetingStore extends ChangeNotifier
HMSKeyChangeListener,
HMSHLSPlaybackEventsListener,
HMSPollListener,
HMSWhiteboardUpdateListener {
HMSWhiteboardUpdateListener,
HMSTranscriptListener {
late HMSSDKInteractor _hmsSDKInteractor;

MeetingStore({required HMSSDKInteractor hmsSDKInteractor}) {
Expand Down Expand Up @@ -276,6 +278,13 @@ class MeetingStore extends ChangeNotifier
///variable to store whiteboard model
HMSWhiteboardModel? whiteboardModel;

///variable to store whether transcription is enabled or not
bool isTranscriptionEnabled = false;

bool isTranscriptionDisplayed = false;

List<HMSTranscription> captions = [];

Future<HMSException?> join(String userName, String? tokenData) async {
late HMSConfig joinConfig;

Expand Down Expand Up @@ -475,6 +484,9 @@ class MeetingStore extends ChangeNotifier
case HMSToastsType.streamingErrorToast:
toasts.removeWhere(
(toast) => toast.hmsToastType == HMSToastsType.streamingErrorToast);
case HMSToastsType.transcriptionToast:
toasts.removeWhere(
(toast) => toast.hmsToastType == HMSToastsType.transcriptionToast);
}
notifyListeners();
}
Expand Down Expand Up @@ -824,6 +836,40 @@ class MeetingStore extends ChangeNotifier
notifyListeners();
}

///This method is used to toggle the transcription
///for the peer who has admin permissions
void toggleTranscription() async {
HMSException? result;
toasts.add(HMSToastModel(
isTranscriptionEnabled
? "Disabling Closed Captioning for everyone"
: "Enabling Closed Captioning for everyone",
hmsToastType: HMSToastsType.transcriptionToast));
if (isTranscriptionEnabled) {
result = await HMSTranscriptionController.stopTranscription();
} else {
result = await HMSTranscriptionController.startTranscription();
}
if (result == null) {
isTranscriptionEnabled = !isTranscriptionEnabled;
toggleTranscriptionDisplay();
} else {
removeToast(HMSToastsType.transcriptionToast);
toasts.add(HMSToastModel(result, hmsToastType: HMSToastsType.errorToast));
}
notifyListeners();
}

void toggleTranscriptionDisplay() {
isTranscriptionDisplayed = !isTranscriptionDisplayed;
if (isTranscriptionDisplayed) {
HMSTranscriptionController.addListener(listener: this);
} else {
HMSTranscriptionController.removeListener();
}
notifyListeners();
}

// Override Methods

@override
Expand All @@ -850,6 +896,16 @@ class MeetingStore extends ChangeNotifier
streamingType["hls"] =
room.hmshlsStreamingState?.state ?? HMSStreamingState.none;

int index = room.transcriptions?.indexWhere(
(element) => element.mode == HMSTranscriptionMode.caption) ??
-1;

if (index != -1) {
room.transcriptions?[index].state == HMSTranscriptionState.started
? isTranscriptionEnabled = true
: isTranscriptionEnabled = false;
}

checkNoiseCancellationAvailability();
setParticipantsList(roles);
toggleAlwaysScreenOn();
Expand Down Expand Up @@ -906,6 +962,7 @@ class MeetingStore extends ChangeNotifier
notifyListeners();
fetchPollList(HMSPollState.stopped);
HMSWhiteboardController.addHMSWhiteboardUpdateListener(listener: this);
HMSTranscriptionController.addListener(listener: this);

if (HMSRoomLayout.roleLayoutData?.screens?.preview?.joinForm?.joinBtnType ==
JoinButtonType.JOIN_BTN_TYPE_JOIN_AND_GO_LIVE &&
Expand Down Expand Up @@ -1000,6 +1057,28 @@ class MeetingStore extends ChangeNotifier
? room.hmshlsStreamingState?.variants[0]?.hlsStreamUrl
: null;
break;
case HMSRoomUpdate.transcriptionsUpdated:
if (room.transcriptions?.isNotEmpty ?? false) {
int index = room.transcriptions?.indexWhere(
(element) => element.mode == HMSTranscriptionMode.caption) ??
-1;

if (index != -1) {
if (room.transcriptions?[index].state ==
HMSTranscriptionState.started ||
room.transcriptions?[index].state ==
HMSTranscriptionState.stopped) {
removeToast(HMSToastsType.transcriptionToast);
}
if (room.transcriptions?[index].state ==
HMSTranscriptionState.started) {
isTranscriptionEnabled = true;
} else {
isTranscriptionEnabled = false;
}
}
}
break;
default:
break;
}
Expand Down Expand Up @@ -1406,6 +1485,7 @@ class MeetingStore extends ChangeNotifier
HMSHLSPlayerController.removeHMSHLSPlaybackEventsListener(this);
HMSPollInteractivityCenter.removePollUpdateListener();
HMSWhiteboardController.removeHMSWhiteboardUpdateListener();
HMSTranscriptionController.removeListener();
}

///Function to toggle screen share
Expand Down Expand Up @@ -2676,6 +2756,29 @@ class MeetingStore extends ChangeNotifier
notifyListeners();
}

bool areCaptionsEmpty = true;
Timer? transcriptionTimerObj;

@override
void onTranscripts({required List<HMSTranscription> transcriptions}) {
areCaptionsEmpty = false;
captions = transcriptions;
startTranscriptionHideTimer();
transcriptions.forEach((element) {
log("onTranscripts -> text: ${element.transcript}");
});
notifyListeners();
}

void startTranscriptionHideTimer() {
transcriptionTimerObj?.cancel();
transcriptionTimerObj = Timer(Duration(seconds: 4), () {
areCaptionsEmpty = true;
captions = [];
notifyListeners();
});
}

//Get onSuccess or onException callbacks for HMSActionResultListenerMethod
@override
void onSuccess(
Expand Down
Loading

0 comments on commit 5d2be71

Please sign in to comment.