From e6fd5b06b83ed5e182a3f2c878c6fdb869ea7712 Mon Sep 17 00:00:00 2001 From: Decoder07 Date: Wed, 8 May 2024 19:04:15 +0530 Subject: [PATCH] Added music mode in android --- .../lib/src/screen_controller.dart | 1 + .../lib/src/service/app_debug_config.dart | 2 + packages/hmssdk_flutter/android/build.gradle | 8 +-- .../HMSTrackSettingsExtension.kt | 13 ++++ .../hmssdk_flutter/example/ios/Podfile.lock | 2 +- .../lib/app_settings_bottom_sheet.dart | 2 + packages/hmssdk_flutter/example/pubspec.lock | 66 ++++++------------- 7 files changed, 44 insertions(+), 50 deletions(-) diff --git a/packages/hms_room_kit/lib/src/screen_controller.dart b/packages/hms_room_kit/lib/src/screen_controller.dart index b073d8f54..5aef5e369 100644 --- a/packages/hms_room_kit/lib/src/screen_controller.dart +++ b/packages/hms_room_kit/lib/src/screen_controller.dart @@ -145,6 +145,7 @@ class _ScreenControllerState extends State { joinWithMutedVideo: true, isSoftwareDecoderDisabled: AppDebugConfig.isSoftwareDecoderDisabled, isAudioMixerDisabled: AppDebugConfig.isAudioMixerDisabled, + audioMode: AppDebugConfig.audioMode, isNoiseCancellationEnabled: widget.options?.enableNoiseCancellation ?? false, isPrebuilt: true); diff --git a/packages/hms_room_kit/lib/src/service/app_debug_config.dart b/packages/hms_room_kit/lib/src/service/app_debug_config.dart index 39573c59a..376683079 100644 --- a/packages/hms_room_kit/lib/src/service/app_debug_config.dart +++ b/packages/hms_room_kit/lib/src/service/app_debug_config.dart @@ -13,6 +13,7 @@ class AppDebugConfig { static bool isAudioMixerDisabled = true; static bool isAutoSimulcast = true; static bool nameChangeOnPreview = true; + static HMSAudioMode audioMode = HMSAudioMode.VOICE; static bool isDebugMode = false; static bool isProdRoom = true; @@ -30,5 +31,6 @@ class AppDebugConfig { isAutoSimulcast = true; isProdRoom = true; nameChangeOnPreview = true; + audioMode = HMSAudioMode.VOICE; } } diff --git a/packages/hmssdk_flutter/android/build.gradle b/packages/hmssdk_flutter/android/build.gradle index 6accc5814..a82d6c911 100644 --- a/packages/hmssdk_flutter/android/build.gradle +++ b/packages/hmssdk_flutter/android/build.gradle @@ -47,10 +47,10 @@ android { } dependencies { - implementation "live.100ms:android-sdk:${sdkVersions['android']}" - implementation "live.100ms:video-view:${sdkVersions['android']}" - implementation "live.100ms:hls-player:${sdkVersions['android']}" - implementation "live.100ms:hms-noise-cancellation-android:${sdkVersions['android']}" + implementation "com.github.100mslive.android-sdk:video-view:feature~music-mode-SNAPSHOT" + implementation "com.github.100mslive.android-sdk:hls-player:feature~music-mode-SNAPSHOT" + implementation 'com.github.100mslive.android-sdk:android-sdk:feature~music-mode-SNAPSHOT' + implementation "com.github.100mslive.android-sdk:hms-noise-cancellation-android:feature~music-mode-SNAPSHOT" implementation 'com.google.code.gson:gson:2.9.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0' diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSTrackSettingsExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSTrackSettingsExtension.kt index 2a742e6a0..cff6f0705 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSTrackSettingsExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSTrackSettingsExtension.kt @@ -58,6 +58,11 @@ class HMSTrackSettingsExtension { hmsAudioTrackSettings.enableNoiseCancellation(true) } } + + val audioMode = audioHashMap["audio_mode"] as? String + audioMode?.let {mode -> + hmsAudioTrackSettings.setAudioMode(getAudioModeFromString(mode)) + } } var hmsVideoTrackSettings = HMSVideoTrackSettings.Builder() @@ -94,5 +99,13 @@ class HMSTrackSettingsExtension { else -> HMSVideoTrackSettings.CameraFacing.FRONT } } + + private fun getAudioModeFromString(audioMode: String): HMSAudioTrackSettings.HMSAudioMode{ + return when(audioMode){ + "voice" -> HMSAudioTrackSettings.HMSAudioMode.HMSAUDIOMODEVOICE + "music" -> HMSAudioTrackSettings.HMSAudioMode.HMSAUDIOMODEMUSIC + else -> HMSAudioTrackSettings.HMSAudioMode.HMSAUDIOMODEVOICE + } + } } } diff --git a/packages/hmssdk_flutter/example/ios/Podfile.lock b/packages/hmssdk_flutter/example/ios/Podfile.lock index b71a3d963..cad71311c 100644 --- a/packages/hmssdk_flutter/example/ios/Podfile.lock +++ b/packages/hmssdk_flutter/example/ios/Podfile.lock @@ -319,4 +319,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 9fb9f6e431a2c6c79942252e94b241ac7972ac90 -COCOAPODS: 1.15.2 +COCOAPODS: 1.14.3 diff --git a/packages/hmssdk_flutter/example/lib/app_settings_bottom_sheet.dart b/packages/hmssdk_flutter/example/lib/app_settings_bottom_sheet.dart index 7186aecb3..83fd85e35 100644 --- a/packages/hmssdk_flutter/example/lib/app_settings_bottom_sheet.dart +++ b/packages/hmssdk_flutter/example/lib/app_settings_bottom_sheet.dart @@ -86,6 +86,7 @@ class _AppSettingsBottomSheetState extends State { AppDebugConfig.skipPreview = skipPreview; AppDebugConfig.isDebugMode = isDebugMode; AppDebugConfig.nameChangeOnPreview = true; + AppDebugConfig.audioMode = currentAudioMode; } Future _launchUrl() async { @@ -431,6 +432,7 @@ class _AppSettingsBottomSheetState extends State { currentAudioMode: currentAudioMode, changeAudioMode: (newMode) { setAudioMode(newMode); + AppDebugConfig.audioMode = newMode; Utilities.saveIntData( key: "audio-mode", value: newMode.index); })); diff --git a/packages/hmssdk_flutter/example/pubspec.lock b/packages/hmssdk_flutter/example/pubspec.lock index 085e6fe80..60ffda515 100644 --- a/packages/hmssdk_flutter/example/pubspec.lock +++ b/packages/hmssdk_flutter/example/pubspec.lock @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.17.2" convert: dependency: transitive description: @@ -342,30 +342,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" - url: "https://pub.dev" - source: hosted - version: "10.0.0" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 - url: "https://pub.dev" - source: hosted - version: "2.0.1" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 - url: "https://pub.dev" - source: hosted - version: "2.0.1" linkify: dependency: transitive description: @@ -386,26 +362,26 @@ packages: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.9.1" mime: dependency: transitive description: @@ -450,10 +426,10 @@ packages: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.3" path_parsing: dependency: transitive description: @@ -687,18 +663,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" string_scanner: dependency: transitive description: @@ -719,10 +695,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.6.0" tuple: dependency: transitive description: @@ -851,14 +827,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.0+2" - vm_service: + web: dependency: transitive description: - name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "0.1.4-beta" win32: dependency: transitive description: @@ -884,5 +860,5 @@ packages: source: hosted version: "6.3.0" sdks: - dart: ">=3.2.0-0 <4.0.0" + dart: ">=3.1.0 <4.0.0" flutter: ">=3.13.0"