Comments (11)
Not a working solution but if you want your build to build you can change
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, with: AVAudioSession.CategoryOptions.defaultToSpeaker)
to
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, options: AVAudioSession.CategoryOptions.defaultToSpeaker);
from audio_recorder.
also change this line
switch AVAudioSession.sharedInstanc.recordPermission(){
case AVAudioSession.RecordPermission.granted:
to
switch AVAudioSession.sharedInstance().recordPermission{
case AVAudioSession.RecordPermission.granted:
to resolve the other error
from audio_recorder.
Had the same issue resolved by @lucygeneric mentioned;
from audio_recorder.
@DyaryRaoof any work around this issue ?
from audio_recorder.
I tried the solutions @DyaryRaoof and @lucygeneric wrote but now when I click the start record button my entire application just crashes...if anyone could help it would be greatly appreciated
from audio_recorder.
what error do you get when it crashes ? have you tried flutter run --verbose to see the error message ?
from audio_recorder.
@DyaryRaoof @LarrySimiyu , Hi Dyaru , I have followed all the changes mentioned , but My app is crashing too, here the error, please let me know how can I solve this issue.
Flutter Output :
Fatal error: Unexpectedly found nil while unwrapping an Optional value: file audio_recorder/SwiftAudioRecorderPlugin.swift, line 42
Lost connection to device.
Line 42 SwiftAudioRecorderPlugin.swift -
audioRecorder = try AVAudioRecorder(url: URL(string: mPath)!, settings: settings)
Full Block Code -
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, options:
AVAudioSession.CategoryOptions.defaultToSpeaker);
try AVAudioSession.sharedInstance().setActive(true)
--------> audioRecorder = try AVAudioRecorder(url: URL(string: mPath)!, settings: settings)
audioRecorder.delegate = self
audioRecorder.record()
} catch {
print("fail")
result(FlutterError(code: "", message: "Failed to record", details: nil))
}
And as per the suggestions in github I have made below changes,
also change this line
switch AVAudioSession.sharedInstanc.recordPermission(){
case AVAudioSession.RecordPermission.granted:
to
switch AVAudioSession.sharedInstance().recordPermission{
case AVAudioSession.RecordPermission.granted:
Not a working solution but if you want your build to build you can change
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, with: AVAudioSession.CategoryOptions.defaultToSpeaker)
to
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, options: AVAudioSession.CategoryOptions.defaultToSpeaker);
from audio_recorder.
Hi. I haven't used the plugin in a while. I am surprised they haven't yet fixed the issue.
Your error shows that "unexpectedly found nill while unwrapping optional" . It means the value that that that line depends on is null. Probably you don't get the permission to use the microphone , either haven't added the necessary line in info.plist or you need to use permission_handler package to get permission to use the mic before start recording.
Also try changing this line Line 42 SwiftAudioRecorderPlugin.swift -
audioRecorder = try AVAudioRecorder(url: URL(string: mPath)!, settings: settings)
Remove the ! After mPath)
Also look at the plugin in Xcode it will show you errors and will try to give suggestions to fox the error in the after you run the app.
Hope this helps.
from audio_recorder.
Hi @DyaryRaoof , yes I have permission handler, and also Microphone is allowed in App Settings,
after changing the ! , I am getting below error for the same,
d/ios/Classes/SwiftAudioRecorderPlugin.swift:42:58: error: value of optional type
'URL?' must be unwrapped to a value of type 'URL'
audioRecorder = try AVAudioRecorder(url: URL(string: mPath), settings: settings)
I am testing on emulator , is it because of that I am using Emulator Audio Recording is not working
from audio_recorder.
Probably. I am not sure.
from audio_recorder.
Hi , im having the same issue i tried the above solution.After change it the xcode build done correctly but giving errors in xcode output.I'm using an ios emulator could that be the problem? Do we need a physical device to test these?
/Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/audio_recorder-1.0.2/ios/Classes/SwiftAudioRecorderPlugin.swift:42:58: error: value of optional type 'URL?' must be unwrapped to a value of type 'URL'
audioRecorder = try AVAudioRecorder(url: URL(string: mPath), settings: settings)
from audio_recorder.
Related Issues (20)
- Exception miss kotlin files HOT 11
- Can't play audio recorded on android, send to server , and received from on iOS HOT 1
- Build failed in example app HOT 3
- Audio quality
- Flutter1.12.13 build has problem HOT 1
- problem, pleasse solution
- compiler error: HOT 3
- doesn't return proper audio file on iOS HOT 3
- 1.7.3 Flutter run on IOS error HOT 13
- Size : Zero octets
- Missing License in Flutters showAboutDialog
- SwiftAudioRecorderPlugin.swift build issues HOT 2
- This package needs to be updated to file: ^6.0.0-nullsafety.2 HOT 4
- Is this project abandoned??
- audio_recorder: 1.0.2 ios build error HOT 3
- Getting error 'MediaRecorder: start called in an invalid state: 4' HOT 2
- Header 'audio_recorder-Swift.h' not found
- null safety HOT 2
- can i use this on WEB ? when i get error "No implementation found for method hasPermissions on channel audio_recorder"
- MissingPluginException(No implementation found for method start on channel audio_recorder) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audio_recorder.