In fact, it is not at all surprising that many people have difficulties with the
SoundRecorder
and/or thePlayer
component. So here is a guide on the subject.
There are numerous issues with the SoundRecorder and Player components when not saving to and playing from the ASD. I won't list them all here (just the most important). Everyone can test it themselves.
You cannot record
.3gp
files in the Shared folder/Music
on Android 11+.
READ
permission is incorrectly requested for the Player component also on Android 11+ for the Shared folders.The
Player
component cannot play audio files with the absolute path/storage/emulated/0/...
from the Shared folders (at least not on Android 11+). The full path (file:///storage/emulated/0/...
) must be used or the abolute path:/scard/...
The
TaifunPlayer
cannot play from the path/scard/...
but only from these paths:
/storage/emulated/0/...
(absolute path) or
file:///storage/emulated/0/...
(full path).In order for the
SoundRecorder
component to also work on devices with Android < 11,WRITE
permission must be declared in the Manifest and should then be requested automatically. Both is not the case.If
WRITE
was declared in the Manifest on Android < 11 (by enablingWritePermission
in the Designer in theFile
component), it will not be requested automatically. This has to be done manually.
As I said, these are not all but the most important things to consider. If anyone notices any other discrepancies / bugs, please post them here. Test with Companion & APK.
recPlaySoundPath.aia (36.1 KB)
Conclusion
To make it short, there are ways to avoid these problems, as I have shown.
However, I would recommend the following:
If the app is only to be created for Android, use a wavRecoder instead of the SoundRecorder. Firstly, this produces a far better sound quality and secondly avoids the storage permissions problems (especially on Android 11+). But if you want to stick with the SoundRecoder component, I generally recommend saving the recording with the.mp3
extension, regardless of the fact that the audio format is still a3gp
(container) format. For the player component, it's best to always use a full path. If you want to avoid the storage permission issue with thePlayer
component on Android 11+, use theTaifunPlayer
from @Taifun.