From b9c345c399a3803f45447cf6fa40424d3346a531 Mon Sep 17 00:00:00 2001 From: Decoder07 Date: Thu, 6 Jun 2024 15:31:36 +0530 Subject: [PATCH] Updated vb functionality --- packages/hms_room_kit/example/pubspec.lock | 2 +- .../lib/src/meeting/meeting_store.dart | 9 +++++++++ .../video_effects_bottom_sheet.dart | 17 ++++++++++++++++- packages/hms_room_kit/pubspec.lock | 2 +- packages/hmssdk_flutter/example/lib/main.dart | 3 +++ packages/hmssdk_flutter/example/pubspec.lock | 2 +- 6 files changed, 31 insertions(+), 4 deletions(-) diff --git a/packages/hms_room_kit/example/pubspec.lock b/packages/hms_room_kit/example/pubspec.lock index 7ffc9b86f..cc6428702 100644 --- a/packages/hms_room_kit/example/pubspec.lock +++ b/packages/hms_room_kit/example/pubspec.lock @@ -244,7 +244,7 @@ packages: description: path: "." ref: develop - resolved-ref: "4b37433ddf0144b01806d51d40a05aec0b754b00" + resolved-ref: "8db1d9dd0b560fbceba35a081fb18d2d9cb6269e" url: "https://github.com/100mslive/hms_video_plugin.git" source: git version: "0.0.1" diff --git a/packages/hms_room_kit/lib/src/meeting/meeting_store.dart b/packages/hms_room_kit/lib/src/meeting/meeting_store.dart index e3ed2aa0a..c3c36f88e 100644 --- a/packages/hms_room_kit/lib/src/meeting/meeting_store.dart +++ b/packages/hms_room_kit/lib/src/meeting/meeting_store.dart @@ -6,6 +6,7 @@ import 'dart:developer'; import 'dart:io'; //Package imports +import 'package:hms_video_plugin/hms_video_plugin.dart'; import 'package:hmssdk_flutter/hmssdk_flutter.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -1351,6 +1352,14 @@ class MeetingStore extends ChangeNotifier // clearPIPState(); removeListeners(); toggleAlwaysScreenOn(); + if (AppDebugConfig.isBlurEnabled) { + HMSVideoPlugin.disableBlur(); + AppDebugConfig.isBlurEnabled = false; + } + if (AppDebugConfig.isVBEnabled) { + HMSVideoPlugin.disable(); + AppDebugConfig.isVBEnabled = false; + } _hmsSDKInteractor.destroy(); _hmsSessionStore = null; peerTracks.clear(); diff --git a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/video_effects_bottom_sheet.dart b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/video_effects_bottom_sheet.dart index 471aebe41..4a099118d 100644 --- a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/video_effects_bottom_sheet.dart +++ b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/video_effects_bottom_sheet.dart @@ -3,7 +3,9 @@ library; ///Package imports import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hms_room_kit/src/meeting/meeting_store.dart'; import 'package:hms_video_plugin/hms_video_plugin.dart'; +import 'package:hmssdk_flutter/hmssdk_flutter.dart'; import 'package:image_picker/image_picker.dart'; ///Project imports @@ -11,9 +13,13 @@ import 'package:hms_room_kit/hms_room_kit.dart'; import 'package:hms_room_kit/src/widgets/common_widgets/hms_cross_button.dart'; import 'package:hms_room_kit/src/widgets/common_widgets/hms_subheading_text.dart'; import 'package:hms_room_kit/src/widgets/common_widgets/more_option_item.dart'; +import 'package:provider/provider.dart'; ///[VideoEffectsBottomSheet] is a bottom sheet that is used to change the video effects class VideoEffectsBottomSheet extends StatefulWidget { + final HMSVideoTrack? localVideoTrack; + + const VideoEffectsBottomSheet({super.key, this.localVideoTrack}); @override State createState() => _VideoEffectsBottomSheetState(); @@ -31,6 +37,13 @@ class _VideoEffectsBottomSheetState extends State { } else if (AppDebugConfig.isVBEnabled) { setEffect("background"); } + context.read().addBottomSheet(context); + } + + @override + void deactivate() { + context.read().removeBottomSheet(context); + super.deactivate(); } void changeBlur(int blurRadius) { @@ -114,7 +127,7 @@ class _VideoEffectsBottomSheetState extends State { if (AppDebugConfig.isBlurEnabled) { HMSVideoPlugin.disableBlur(); AppDebugConfig.isBlurEnabled = false; - } else if (AppDebugConfig.isVirtualBackgroundEnabled) { + } else if (AppDebugConfig.isVBEnabled) { HMSVideoPlugin.disable(); AppDebugConfig.isVBEnabled = false; } @@ -138,6 +151,7 @@ class _VideoEffectsBottomSheetState extends State { child: MoreOptionItem( onTap: () { Navigator.pop(context); + AppDebugConfig.isVBEnabled = false; changeBlur(100); }, optionIcon: SvgPicture.asset( @@ -157,6 +171,7 @@ class _VideoEffectsBottomSheetState extends State { Expanded( child: MoreOptionItem( onTap: () async { + AppDebugConfig.isBlurEnabled = false; Navigator.pop(context); setEffect("background"); XFile? result = await ImagePicker() diff --git a/packages/hms_room_kit/pubspec.lock b/packages/hms_room_kit/pubspec.lock index b990ff40b..f47966e27 100644 --- a/packages/hms_room_kit/pubspec.lock +++ b/packages/hms_room_kit/pubspec.lock @@ -221,7 +221,7 @@ packages: description: path: "." ref: develop - resolved-ref: "4b37433ddf0144b01806d51d40a05aec0b754b00" + resolved-ref: "8db1d9dd0b560fbceba35a081fb18d2d9cb6269e" url: "https://github.com/100mslive/hms_video_plugin.git" source: git version: "0.0.1" diff --git a/packages/hmssdk_flutter/example/lib/main.dart b/packages/hmssdk_flutter/example/lib/main.dart index a2c64b49f..dd863785e 100644 --- a/packages/hmssdk_flutter/example/lib/main.dart +++ b/packages/hmssdk_flutter/example/lib/main.dart @@ -501,6 +501,9 @@ class _HomePageState extends State { borderRadius: BorderRadius.circular(8.0), ))), onPressed: () async { + bool isVBEnabled = await Utilities.getBoolData( + key: "is_virtual_background_enabled")??false; + AppDebugConfig.isVirtualBackgroundEnabled = isVBEnabled; joinMeeting(); }, child: Container( diff --git a/packages/hmssdk_flutter/example/pubspec.lock b/packages/hmssdk_flutter/example/pubspec.lock index 282f9f884..dd2a50d7c 100644 --- a/packages/hmssdk_flutter/example/pubspec.lock +++ b/packages/hmssdk_flutter/example/pubspec.lock @@ -341,7 +341,7 @@ packages: description: path: "." ref: develop - resolved-ref: "3ea3e5d0b31fc8ab2653f169f957fafd4766a6c0" + resolved-ref: "8db1d9dd0b560fbceba35a081fb18d2d9cb6269e" url: "https://github.com/100mslive/hms_video_plugin.git" source: git version: "0.0.1"