Skip to content

Commit

Permalink
feat:✨Added support for configuring the audio recording quality.(#121).
Browse files Browse the repository at this point in the history
  • Loading branch information
jaiminrana05 authored and apurva010 committed May 21, 2024
1 parent 555c90b commit eba6569
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 22 deletions.
40 changes: 22 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,71 +16,73 @@

## [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]

* **Fix**: [60](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/60) Fix image from
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]
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions lib/chatview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ 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';
export 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
27 changes: 26 additions & 1 deletion lib/src/models/send_message_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ class ImagePickerConfiguration {
});
}

/// Styling configuration for recorder widget.
class VoiceRecordingConfiguration {
/// Styling configuration for the recorder widget as well as
/// configuring the audio recording quality.
const VoiceRecordingConfiguration({
this.waveStyle,
this.padding,
Expand All @@ -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.
Expand All @@ -237,4 +243,23 @@ class VoiceRecordingConfiguration {

/// Applies color to mic and stop icon.
final Color? recorderIconColor;

/// The sample rate for audio is measured in samples per second.
/// A higher sample rate generates more samples per second,
/// resulting in better audio quality but also larger file sizes.
final int? sampleRate;

/// Bitrate is the amount of data per second that the codec uses to
/// encode the audio. A higher bitrate results in better quality
/// but also larger file sizes.
final int? bitRate;

/// Audio encoder to be used for recording for IOS.
final IosEncoder? iosEncoder;

/// Audio encoder to be used for recording for Android.
final AndroidEncoder? androidEncoder;

/// The audio output format to be used for recorded audio files on Android.
final AndroidOutputFormat? androidOutputFormat;
}
8 changes: 7 additions & 1 deletion lib/src/widgets/chatui_textfield.dart
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,13 @@ class _ChatUITextFieldState extends State<ChatUITextField> {
"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();
Expand Down

0 comments on commit eba6569

Please sign in to comment.