Skip to content

Commit 7f8dd38

Browse files
📝 Updated docs and fixed docs,variable name,function names typos (#92)
1 parent 6a72018 commit 7f8dd38

File tree

18 files changed

+415
-331
lines changed

18 files changed

+415
-331
lines changed

CHANGELOG.md

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,61 @@
1-
## [0.1.5] - 7 Sept, 2022
1+
## 0.1.5
22

3-
* Added bitRate feature for Android & IOS (Default to 64kbps).
3+
- Added bitRate feature for Android & IOS (Default to 64kbps) - thanks [@abhay-s-rawat](https://github.com/abhay-s-rawat).
4+
- Fixed [#86](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/86) - thanks [@rlee1990](https://github.com/rlee1990)
5+
- Updated docs and fixed docs,variable name,function names typos
6+
- Removed dates from changelog(see versions tab from pub.dev to get release version dates).
47

5-
## [0.1.4] - 1 Aug, 2022
8+
## 0.1.4
69

710
- Fixed [#71](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/71) - Bump compileSdkVersion/gradle/kotlin to match flutter 3.0 - thanks [@yohom](https://github.com/yohom)
811
- Fixed [#74](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/74) - Fixed push back distance wouldn't reset when recording again
912

10-
## [0.1.3] - 28 July, 2022
13+
## 0.1.3
1114

1215
- Fixed [#41](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/41) & [#49](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/49) - Upgrade Package with flutter 3.0.
1316
- Fixed [#50](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/50) & [#57](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/57) & [#65](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/65) - android build error fixed
1417
- Fixed ios resume recording issue
1518
- Fixed player state not getting update when playing is finished by providing PlayerState stream.
1619
- Added current duration stream for PlayerController.
17-
- Breaking: Replaced `seekToStart` parameter from `startPlayer()` with `FinishMode` enum for
20+
- **BREAKING**: Replaced `seekToStart` parameter from `startPlayer()` with `FinishMode` enum for
1821
better controls when audio is finished
19-
- Breaking: Renamed `disposeFunc()` to simpler `dispose()` for both controllers
22+
- **BREAKING**: Renamed `disposeFunc()` to simpler `dispose()` for both controllers
2023
- Internal native restructure.
21-
- Minor documentation update
24+
- Minor documentation update.
2225

23-
## [0.1.1] - 28 April, 2022
26+
## 0.1.1
2427

25-
* Get current time with respect to scroll
28+
- Get current time with respect to scroll
2629

27-
## [0.1.0] - 26 April, 2022
30+
## 0.1.0
2831

29-
* Added functionality to play audio file and generate waveform from it.
30-
* Breaking: Renamed WaveController to RecorderController
31-
* Updated metering level for ios to average power
32-
* Fixed label would not clear after stopping the recorder. With this, exposed `reset()` function to remove labels
32+
- Added functionality to play audio file and generate waveform from it.
33+
- **BREAKING**: Renamed WaveController to RecorderController
34+
- Updated metering level for ios to average power
35+
- Fixed label would not clear after stopping the recorder. With this, exposed `reset()` function to remove labels
3336
when `callReset` flag in `stop()` is set to false.
34-
* Updated example app
37+
- Updated example app
3538

36-
## [0.0.4] - 11 April, 2022
39+
## 0.0.4
3740

38-
* Separated encoder input for android and ios better support
41+
- Separated encoder input for android and ios better support
3942

40-
## [0.0.3+2] - 23 March, 2022
43+
## 0.0.3+2
4144

42-
* Fixed gif preview
45+
- Fixed gif preview
4346

44-
## [0.0.3+1] - 22 March, 2022
47+
## 0.0.3+1
4548

46-
* Updated gif preview url
49+
- Updated gif preview url
4750

48-
## [0.0.3] - 22 March, 2022
51+
## 0.0.3
4952

50-
* Updated preview urls
53+
- Updated preview urls
5154

52-
## [0.0.2] - 22 March, 2022
55+
## 0.0.2
5356

54-
* Updated README.md
57+
- Updated README.md
5558

56-
## [0.0.1] - 22 March, 2022
59+
## 0.0.1
5760

58-
* Initial release
61+
- Initial release

android/src/main/kotlin/com/simform/audio_waveforms/AudioRecorder.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ class AudioRecorder : PluginRegistry.RequestPermissionsResultListener {
173173
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
174174
MediaRecorder.OutputFormat.WEBM
175175
} else {
176-
Log.e(LOG_TAG, "Minimum android Q is required, Setting Acc encoder.")
176+
Log.e(LOG_TAG, "Minimum android Q is required, Setting MPEG_4 output format.")
177177
MediaRecorder.OutputFormat.MPEG_4
178178
}
179179
}
180180
Constants.mpeg_2_ts -> {
181181
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
182182
MediaRecorder.OutputFormat.MPEG_2_TS
183183
} else {
184-
Log.e(LOG_TAG, "Minimum android Q is required, Setting Acc encoder.")
184+
Log.e(LOG_TAG, "Minimum android Q is required, Setting MPEG_4 output format.")
185185
MediaRecorder.OutputFormat.MPEG_4
186186
}
187187
}

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 50;
6+
objectVersion = 51;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -76,7 +76,6 @@
7676
8C10471C785EFBB7EFE70439 /* Pods-Runner.release.xcconfig */,
7777
FDE2CE48427F61D385E68894 /* Pods-Runner.profile.xcconfig */,
7878
);
79-
name = Pods;
8079
path = Pods;
8180
sourceTree = "<group>";
8281
};
@@ -356,6 +355,7 @@
356355
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
357356
CLANG_ENABLE_MODULES = YES;
358357
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
358+
DEVELOPMENT_TEAM = KX234MPD84;
359359
ENABLE_BITCODE = NO;
360360
INFOPLIST_FILE = Runner/Info.plist;
361361
LD_RUNPATH_SEARCH_PATHS = (
@@ -483,6 +483,7 @@
483483
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
484484
CLANG_ENABLE_MODULES = YES;
485485
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
486+
DEVELOPMENT_TEAM = KX234MPD84;
486487
ENABLE_BITCODE = NO;
487488
INFOPLIST_FILE = Runner/Info.plist;
488489
LD_RUNPATH_SEARCH_PATHS = (
@@ -505,6 +506,7 @@
505506
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
506507
CLANG_ENABLE_MODULES = YES;
507508
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
509+
DEVELOPMENT_TEAM = KX234MPD84;
508510
ENABLE_BITCODE = NO;
509511
INFOPLIST_FILE = Runner/Info.plist;
510512
LD_RUNPATH_SEARCH_PATHS = (

example/lib/main.dart

Lines changed: 65 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -186,118 +186,120 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
186186
WaveBubble(
187187
playerController: playerController1,
188188
isPlaying: playerController1.playerState == PlayerState.playing,
189-
onTap: () => _playOrPlausePlayer(playerController1),
189+
onTap: () => _playOrPausePlayer(playerController1),
190190
),
191191
],
192192
if (playerController2.playerState != PlayerState.stopped) ...[
193193
WaveBubble(
194194
playerController: playerController2,
195195
isPlaying: playerController2.playerState == PlayerState.playing,
196-
onTap: () => _playOrPlausePlayer(playerController2),
196+
onTap: () => _playOrPausePlayer(playerController2),
197197
isSender: true,
198198
),
199199
],
200200
if (playerController3.playerState != PlayerState.stopped) ...[
201201
WaveBubble(
202202
playerController: playerController3,
203203
isPlaying: playerController3.playerState == PlayerState.playing,
204-
onTap: () => _playOrPlausePlayer(playerController3),
204+
onTap: () => _playOrPausePlayer(playerController3),
205205
),
206206
],
207207
if (playerController4.playerState != PlayerState.stopped) ...[
208208
WaveBubble(
209209
playerController: playerController4,
210210
isPlaying: playerController4.playerState == PlayerState.playing,
211-
onTap: () => _playOrPlausePlayer(playerController4),
211+
onTap: () => _playOrPausePlayer(playerController4),
212212
isSender: true,
213213
),
214214
],
215215
if (playerController5.playerState != PlayerState.stopped) ...[
216216
WaveBubble(
217217
playerController: playerController5,
218218
isPlaying: playerController5.playerState == PlayerState.playing,
219-
onTap: () => _playOrPlausePlayer(playerController5),
219+
onTap: () => _playOrPausePlayer(playerController5),
220220
isSender: true,
221221
),
222222
],
223223
if (playerController6.playerState != PlayerState.stopped) ...[
224224
WaveBubble(
225225
playerController: playerController6,
226226
isPlaying: playerController6.playerState == PlayerState.playing,
227-
onTap: () => _playOrPlausePlayer(playerController6),
227+
onTap: () => _playOrPausePlayer(playerController6),
228228
isSender: true,
229229
),
230230
],
231231
const Spacer(),
232-
Row(
233-
children: [
234-
AnimatedSwitcher(
235-
duration: const Duration(milliseconds: 200),
236-
child: isRecording
237-
? AudioWaveforms(
238-
enableGesture: true,
239-
size: Size(MediaQuery.of(context).size.width / 2, 50),
240-
recorderController: recorderController,
241-
waveStyle: const WaveStyle(
242-
waveColor: Colors.white,
243-
extendWaveform: true,
244-
showMiddleLine: false,
245-
),
246-
decoration: BoxDecoration(
247-
borderRadius: BorderRadius.circular(12.0),
248-
color: const Color(0xFF1E1B26),
249-
),
250-
padding: const EdgeInsets.only(left: 18),
251-
margin: const EdgeInsets.symmetric(horizontal: 15),
252-
)
253-
: Container(
254-
width: MediaQuery.of(context).size.width / 1.7,
255-
height: 50,
256-
decoration: BoxDecoration(
257-
color: const Color(0xFF1E1B26),
258-
borderRadius: BorderRadius.circular(12.0),
259-
),
260-
padding: const EdgeInsets.only(left: 18),
261-
margin: const EdgeInsets.symmetric(horizontal: 15),
262-
child: TextField(
263-
readOnly: true,
264-
decoration: InputDecoration(
265-
hintText: "Type Something...",
266-
hintStyle: const TextStyle(color: Colors.white54),
267-
contentPadding: const EdgeInsets.only(top: 16),
268-
border: InputBorder.none,
269-
suffixIcon: IconButton(
270-
onPressed: _pickFile,
271-
icon: Icon(Icons.adaptive.share),
272-
color: Colors.white54,
232+
SafeArea(
233+
child: Row(
234+
children: [
235+
AnimatedSwitcher(
236+
duration: const Duration(milliseconds: 200),
237+
child: isRecording
238+
? AudioWaveforms(
239+
enableGesture: true,
240+
size: Size(MediaQuery.of(context).size.width / 2, 50),
241+
recorderController: recorderController,
242+
waveStyle: const WaveStyle(
243+
waveColor: Colors.white,
244+
extendWaveform: true,
245+
showMiddleLine: false,
246+
),
247+
decoration: BoxDecoration(
248+
borderRadius: BorderRadius.circular(12.0),
249+
color: const Color(0xFF1E1B26),
250+
),
251+
padding: const EdgeInsets.only(left: 18),
252+
margin: const EdgeInsets.symmetric(horizontal: 15),
253+
)
254+
: Container(
255+
width: MediaQuery.of(context).size.width / 1.7,
256+
height: 50,
257+
decoration: BoxDecoration(
258+
color: const Color(0xFF1E1B26),
259+
borderRadius: BorderRadius.circular(12.0),
260+
),
261+
padding: const EdgeInsets.only(left: 18),
262+
margin: const EdgeInsets.symmetric(horizontal: 15),
263+
child: TextField(
264+
readOnly: true,
265+
decoration: InputDecoration(
266+
hintText: "Type Something...",
267+
hintStyle: const TextStyle(color: Colors.white54),
268+
contentPadding: const EdgeInsets.only(top: 16),
269+
border: InputBorder.none,
270+
suffixIcon: IconButton(
271+
onPressed: _pickFile,
272+
icon: Icon(Icons.adaptive.share),
273+
color: Colors.white54,
274+
),
273275
),
274276
),
275277
),
276-
),
277-
),
278-
IconButton(
279-
onPressed: _refreshWave,
280-
icon: Icon(
281-
isRecording ? Icons.refresh : Icons.send,
278+
),
279+
IconButton(
280+
onPressed: _refreshWave,
281+
icon: Icon(
282+
isRecording ? Icons.refresh : Icons.send,
283+
color: Colors.white,
284+
),
285+
),
286+
const SizedBox(width: 16),
287+
IconButton(
288+
onPressed: _startOrStopRecording,
289+
icon: Icon(isRecording ? Icons.stop : Icons.mic),
282290
color: Colors.white,
291+
iconSize: 28,
283292
),
284-
),
285-
const SizedBox(width: 16),
286-
IconButton(
287-
onPressed: _startOrStopRecording,
288-
icon: Icon(isRecording ? Icons.stop : Icons.mic),
289-
color: Colors.white,
290-
iconSize: 28,
291-
),
292-
],
293+
],
294+
),
293295
),
294296
],
295297
),
296298
),
297299
);
298300
}
299301

300-
void _playOrPlausePlayer(PlayerController controller) async {
302+
void _playOrPausePlayer(PlayerController controller) async {
301303
controller.playerState == PlayerState.playing
302304
? await controller.pausePlayer()
303305
: await controller.startPlayer(finishMode: FinishMode.loop);

ios/Classes/AudioPlayer.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ class AudioPlayer : NSObject, AVAudioPlayerDelegate {
1919
func preparePlayer(path: String?,volume: Double?,result: @escaping FlutterResult){
2020
if(!(path ?? "").isEmpty){
2121
let audioUrl = URL.init(fileURLWithPath: path!)
22-
player = try! AVAudioPlayer(contentsOf: audioUrl)
22+
do {
23+
player = try AVAudioPlayer(contentsOf: audioUrl)
24+
} catch {
25+
result(FlutterError(code: "", message: "Failed to prepare recording", details: nil))
26+
}
27+
2328
player?.prepareToPlay()
2429
player?.volume = Float(volume ?? 1.0)
2530
result(true)

0 commit comments

Comments
 (0)