Closed jonmdev closed 4 days ago
Thanks for the report. I don't suppose you know whether this has always been the case or has stopped working in a certain version of the plugin? Maybe we can build a sample that reproduces the issue and jump between versions. I asked because there were some changes to recording options.
Thanks for the report. I don't suppose you know whether this has always been the case or has stopped working in a certain version of the plugin? Maybe we can build a sample that reproduces the issue and jump between versions. I asked because there were some changes to recording options.
I wouldn't know. The first time I used this at all was the day I posted this bug report. Certainly the project I gave reproduces it and I presume it can be used with any version of the design since I'm just using the basic API functions.
I note that these users were reporting the same thing as of June:
So it has to be present since at least then.
I think you guys would have to know if this was the case previously. Eg. I watched this tutorial to learn how to use it:
https://www.youtube.com/watch?v=KaHyRSy5sAs
If you were testing it in Android that way I'm sure you would have observed the problem too if it was present. Either way I would have to leave it up to you if you can figure out why it's happening or fix it. It would be appreciated.
My guess would be something to do with the async stopping code or threading if anything is running on a different thread upon stopping. It seems something is desynchronizing or running when it shouldn't be perhaps so a segment of the data stream or buffer is getting copied/read twice at the end while stopping.
ie. Stop command is issued (async or different thread), there is a delay to actually shut off the recording. During this time, the last audio buffer loops and repeats itself going into the recording twice. Then audio recording truly stops, but now with a doubled end buffer segment (glitch).
I would try making the stop command in Android run sync (not async) and test if that fixes it. Then see where the async/threading issue is coming from if so.
Apparently this alternative project still works but I like yours better: https://github.com/NateRickard/Plugin.AudioRecorder
So I hope you can fix it. Thanks.
Thanks for the extensive write-up @jonmdev!
If this is something that is urgent to you I would kindly suggest to maybe pull down the code and see if you can find something yourself. Shaun and I do what we can, but we're doing projects like this in our spare time and its provided mostly as-is.
Of course we try to get to things in a timely fashion, but I think at the moment we don't really know when we will get to this. They way you are writing about it, I get the sense that you would love a solution soon.
If that is not possible from your side, we'll look into it as soon as we can carve out some time!
I can safely say I won't have time in the next month or so to look at this with holidays, child care and other bits. Maybe in September/October I could though
Thanks guys. I do not have time to try to look into it myself which would take perhaps days to week+ for me since I don't know the underlying code or how it was designed or how it works.
If it comes to it, I would have to switch to: : https://github.com/NateRickard/Plugin.AudioRecorder. But I would rather not for 2 reasons: (1) It seems that project saves everything to the disk (requiring me to manually clean up anything I don't need there every time), and (2) That hasn't been updated for 5 years which makes me worry about a breaking change happening any day now in .NET or any given OS.
It's good to know you guys are still working on this even if not constantly. That is fine for me. The project I need this for will not be launching for 4-6 months at this rate.
I have given the best information and ideas I have. I will just wait then and see how you are able to do with it.
Thanks again.
@jfversluis @bijington is there any other method to record audio that you can recommend? It's been a little frustrating and challenging working with MAUI and to add the fact that Audio Recording is also broken is disheartening. Nothing against y'all and amazing work on this plugin - so Thank You for that, just looking for a way forward.
@rezamohamed please remember, all plugins and code out there is work that other have done, that you could have done yourself. It's a helper, a timesaver. If it doesn't work or you don't agree with how it's built, feel free to do it yourself.
All APIs are there, please feel free to implement it in your own project, or preferably, send PRs to make this project better if you're going to look into it anyway and help others and not just yourself.
Nothing about MAUI in this regard is broken. Apparently we have a bug or several bugs in this library and we don't have the time to get to it. I'm sorry about that.
Your app development should not be blocked by not being able to find a plugin that does exactly what you need. All the platform APIs are available to you through .NET and C#.
Sorry if this is a bit direct. I don't mean it the wrong way at all. But just piling on with how disheartening it is and that you need this too isn't very motivating for us either, nor constructive to fixing the issue at hand.
@jfversluis totally get it, and if you noticed in my last sentence I gave nothing but kudos to the work that y'all have done here. Some of us are just not smart enough to dig into the raw APIs and helpers like this are in fact extremely helpful to the majority I would say.
@jonmdev I found the solution for the repeat of the last few seconds. I posted it on my thread along with the other issues I was facing on Android. https://github.com/jfversluis/Plugin.Maui.Audio/issues/115#issuecomment-2323036808
Can this issue be closed down?
Can this issue be closed down?
Nuget shows it has not been updated in 3 months, so I presume the fix is not available for those of us who are not building this from scratch ourselves and just attempting to use it as consumers.
https://www.nuget.org/packages/Plugin.Maui.Audio
Is there any way to update it so we can use the fix?
@jfversluis Are you happy for me to create a release? I think we have a few changes we could ship
Done! Let me know how it goes!
Problem is solved! Thanks.
Thanks first of all @bijington & @jfversluis for creating and sharing the great project. It has saved me some great time and it is very clean and easy to use.
However, there appears to be a problem in Android recording. Each recording typically gets a glitch at the end where the last 0.2-0.5 seconds is repeated. This only happens in Android, not iOS.
So if you record, say "One, Two, Three" then stop, in Android, you get "One, Two, Three, -ee."
BUG PROJECT
https://github.com/jonmdev/PluginMauiAudioBug
BUG REPRODUCTION
This bug project is just a simple absolute layout which covers the screen. On clicking this it will turn yellow when paused or stopped, red when recording, and green when playing back.
In Android, it will save the audio as a wav file to the root storage Documents folder as audiotemp.wav, so you can test the recording in Windows as well from file explorer.
Usage:
1) Click screen to start recording (red) 2) Click screen again to stop recording (yellow) 3) Click screen again to play back (green) or pause if playing (yellow) 4) Click "clear" label to start over if needed 5) Check root Documents folder for audiotemp.wav to confirm playing it in Windows has the glitch (it does)
Issue:
A solution or fix would be greatly appreciated. 🙂🙏
(If it does not reproduce for you, please let me know. It always reproduces on my Samsung Android phone.)
BUG PROJECT CODE
This is a simple project starting from the default Maui project for which the composition steps were:
1) Add to MauiProject.cs:
builder.Services.AddSingleton(AudioManager.Current);
2) Add permissions to AndroidManifest.xml 3) Change App.xaml.cs to the following ~160 lines of code: