diff --git a/CHANGELOG.md b/CHANGELOG.md index 388af78f..5d894f7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [1.3.2] (Unreleased) +* **Feat**: [121](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/121)Added support + for configuring the audio recording quality. * **Fix**: [131](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/131) Fix unsupported operation while running on the web. * **Fix**: [160](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/160) Added @@ -14,28 +16,29 @@ ## [1.3.1] -* **Feat**: [105](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/105) Allow user - to get callback when image is picked so user can perform operation like crop. Allow user to pass +* **Feat**: [105](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/105) Allow user + to get callback when image is picked so user can perform operation like crop. Allow user to pass configuration like height, width, image quality and preferredCameraDevice. -* **Fix**: [95](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/95) Fix issue of +* **Fix**: [95](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/95) Fix issue of chat is added to bottom while `loadMoreData` callback. -* **Fix**: [109](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/109) Added - support for the hiding/Un-hiding gallery and camera buttons - +* **Fix**: [109](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/109) Added + support for the hiding/Un-hiding gallery and camera buttons + ## [1.3.0] * **Feat**: [71](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/71) Added Callback when a user starts/stops composing typing a message. * **Fix**: [78](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/78) Fix issue of unmodifiable list. -* **Feat**: [76](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/76) Message Receipts. +* **Feat**: [76](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/76) Message + Receipts. * **Fix**: [81](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/81) Fix issue of TypingIndicator Rebuilding ChatView. * **Fix**: [94](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/94) Fixed deprecated `showRecentsTab` property with new `recentTabBehavior`. * Support for latest flutter version `3.10.5`. -* Update dependencies `http` to version `1.1.0` and `image_picker` to version range `'>=0.8.9 <2.0.0'`. - +* Update dependencies `http` to version `1.1.0` and `image_picker` to version + range `'>=0.8.9 <2.0.0'`. ## [1.2.1] @@ -43,42 +46,43 @@ file is not loaded. * **Fix**: [61](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/61) Fix issue of audio message is not working. -* **Feat**: [65](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/65) Add callback +* **Feat**: [65](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/65) Add callback when user react on message. - ## [1.2.0+1] -* **Feat**: [42](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/42) Ability to +* **Feat**: [42](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/42) Ability to get callback on tap of profile circle avatar. * **Breaking**: Add `messageType` in `onSendTap` callback for encountering messages. * **Breaking**: Remove `onRecordingComplete` and you can get Recorded audio in `onSendTap` callback with `messageType`. * **Breaking**: Remove `onImageSelected` from `ImagePickerIconsConfiguration` and can get selected image in `onSendTap` callback with `messageType`. -* **Feat**: [49](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/49) Add `onUrlDetect` +* **Feat**: [49](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/49) + Add `onUrlDetect` callback for opening urls. * **Feat**: [51](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/51) Ability to get callback on long press of profile circle avatar. ## [1.1.0] -* **Feat**: [37](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/37) Ability to +* **Feat**: [37](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/37) Ability to enable or disable specific features. * **Feat**: [34](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/34) Ability to add voice message. * **Breaking**: Remove `onEmojiTap` from `ReactionPopupConfiguration`, it can be handled internally. -* **Breaking**: Remove `horizontalDragToShowMessageTime` from `ChatBackgroundConfiguration` and +* **Breaking**: Remove `horizontalDragToShowMessageTime` from `ChatBackgroundConfiguration` and add `enableSwipeToSeeTime` parameter with same feature in `FeatureActiveConfig`. * **Breaking**: Remove `showReceiverProfileCircle` and add `enableOtherUserProfileAvatar` parameter with same feature in `FeatureActiveConfig`. -* * **Breaking**: Move `enablePagination` parameter from `ChatView` to `FeatureActiveConfig`. +* + * **Breaking**: Move `enablePagination` parameter from `ChatView` to `FeatureActiveConfig`. ## [1.0.1] -* **Fix**: [32](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/32) Fix issue of +* **Fix**: [32](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/32) Fix issue of while replying to image it highlights the link instead of the image. -* **Fix**: [35](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/35) Fix issue of +* **Fix**: [35](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/35) Fix issue of removing reaction which is reacted accidentally. ## [1.0.0+1] diff --git a/README.md b/README.md index 2be310be..a92c838e 100644 --- a/README.md +++ b/README.md @@ -533,6 +533,31 @@ ChatView( ) ``` +23. Configure the styling & audio recording quality using `VoiceRecordingConfiguration` in sendMessageConfig. + +```dart +ChatView( + ... + sendMessageConfig: SendMessageConfiguration( + + voiceRecordingConfiguration: VoiceRecordingConfiguration( + iosEncoder: IosEncoder.kAudioFormatMPEG4AAC, + androidOutputFormat: AndroidOutputFormat.mpeg4, + androidEncoder: AndroidEncoder.aac, + bitRate: 128000, + sampleRate: 44100, + waveStyle: WaveStyle( + showMiddleLine: false, + waveColor: theme.waveColor ?? Colors.white, + extendWaveform: true, + ), + ), + + ... + ) +) +``` + ## How to use diff --git a/lib/chatview.dart b/lib/chatview.dart index f3d0edbc..860e1699 100644 --- a/lib/chatview.dart +++ b/lib/chatview.dart @@ -29,7 +29,7 @@ export 'src/values/enumaration.dart'; export 'src/controller/chat_controller.dart'; export 'src/values/typedefs.dart'; export 'package:audio_waveforms/audio_waveforms.dart' - show WaveStyle, PlayerWaveStyle; + show WaveStyle, PlayerWaveStyle,AndroidEncoder,IosEncoder,AndroidOutputFormat; export 'src/models/receipts_widget_config.dart'; export 'src/extensions/extensions.dart' show MessageTypes; export'package:emoji_picker_flutter/emoji_picker_flutter.dart'; diff --git a/lib/src/models/send_message_configuration.dart b/lib/src/models/send_message_configuration.dart index fe5b5e0e..791bfb09 100644 --- a/lib/src/models/send_message_configuration.dart +++ b/lib/src/models/send_message_configuration.dart @@ -200,7 +200,8 @@ class ImagePickerConfiguration { }); } -/// Styling configuration for recorder widget. +/// Styling configuration for recorder widget as well as configuring the audio +/// recording quality. class VoiceRecordingConfiguration { const VoiceRecordingConfiguration({ this.waveStyle, @@ -211,6 +212,11 @@ class VoiceRecordingConfiguration { this.micIcon, this.recorderIconColor, this.stopIcon, + this.sampleRate, + this.bitRate, + this.androidEncoder, + this.iosEncoder, + this.androidOutputFormat, }); /// Applies styles to waveform. @@ -237,4 +243,31 @@ class VoiceRecordingConfiguration { /// Applies color to mic and stop icon. final Color? recorderIconColor; + + /// Below parameter are use for changing the audio recoding quality. + + ///The sample-rate for audio in samples per second. + /// Higher the sample-rate, more sample will generate per second, + /// but also larger the file size. + ///default value:44100 + final int? sampleRate; + + /// Bitrate is the amount of data per second that the codec uses to encode + /// the audio. + /// Higher the bitrate, the better the quality, but also larger + /// the file size. + /// default value: null (platform will decide) + final int? bitRate; + + /// Audio encoder to be used for recording for IOS + /// default value:IosEncoder.kAudioFormatMPEG4AAC + final IosEncoder? iosEncoder; + + /// Audio encoder to be used for recording for Android + /// default value:AndroidEncoder.aac + final AndroidEncoder? androidEncoder; + + /// Audio decoder to be used for recording output for Android + /// default value: AndroidOutputFormat.mpeg4 + final AndroidOutputFormat? androidOutputFormat; } diff --git a/lib/src/widgets/chatui_textfield.dart b/lib/src/widgets/chatui_textfield.dart index d5bccf80..4b1c5501 100644 --- a/lib/src/widgets/chatui_textfield.dart +++ b/lib/src/widgets/chatui_textfield.dart @@ -284,7 +284,13 @@ class _ChatUITextFieldState extends State { "Voice messages are only supported with android and ios platform", ); if (!isRecording.value) { - await controller?.record(); + await controller?.record( + sampleRate: voiceRecordingConfig?.sampleRate, + bitRate: voiceRecordingConfig?.bitRate, + androidEncoder: voiceRecordingConfig?.androidEncoder, + iosEncoder: voiceRecordingConfig?.iosEncoder, + androidOutputFormat: voiceRecordingConfig?.androidOutputFormat, + ); isRecording.value = true; } else { final path = await controller?.stop();