In fact, it is not at all surprising that many people have difficulties with the
SoundRecorderand/or thePlayercomponent. 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
.3gpfiles in the Shared folder/Musicon Android 11+.
READpermission is incorrectly requested for the Player component also on Android 11+ for the Shared folders.The
Playercomponent 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
TaifunPlayercannot 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
SoundRecordercomponent to also work on devices with Android < 11,WRITEpermission must be declared in the Manifest and should then be requested automatically. Both is not the case.If
WRITEwas declared in the Manifest on Android < 11 (by enablingWritePermissionin the Designer in theFilecomponent), 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.mp3extension, 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 thePlayercomponent on Android 11+, use theTaifunPlayerfrom @Taifun.
