In
JUCE v7.o.9
Tiramisu Android 13.0, API 33
AudioPlaybackDemo
if I use the code that projuser creates to select audio files:
if (btn == &chooseFileButton && fileChooser.get() == nullptr)
{
if (! RuntimePermissions::isGranted (RuntimePermissions::readExternalStorage))
{
SafePointer<AudioPlaybackDemo> safeThis (this);
RuntimePermissions::request (RuntimePermissions::readExternalStorage,
[safeThis] (bool granted) mutable
{
if (safeThis != nullptr && granted)
safeThis->buttonClicked (&safeThis->chooseFileButton);
});
return;
}
if (FileChooser::isPlatformDialogAvailable())
{
fileChooser = std::make_unique<FileChooser> ("Select an audio file...", File(), "*.wav;*.flac;*.aif");
fileChooser->launchAsync (FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles,
[this] (const FileChooser& fc) mutable
{
if (fc.getURLResults().size() > 0)
{
auto u = fc.getURLResult();
showAudioResource (std::move (u));
}
fileChooser = nullptr;
}, nullptr);
}
else
{
NativeMessageBox::showAsync (MessageBoxOptions()
.withIconType (MessageBoxIconType::WarningIcon)
.withTitle ("Enable Code Signing")
.withMessage ("You need to enable code-signing for your iOS project and enable \"iCloud Documents\" "
"permissions to be able to open audio files on your iDevice. See: "
"https://forum.juce.com/t/native-ios-android-file-choosers"),
nullptr);
}
}
then I can’t select any files at all.
But if I change it to
if (btn == &chooseFileButton && fileChooser.get() == nullptr)
{
if (! RuntimePermissions::isGranted (RuntimePermissions::readExternalStorage))
{
SafePointer<AudioPlaybackDemo> safeThis (this);
RuntimePermissions::request (RuntimePermissions::readExternalStorage,
[safeThis] (bool granted) mutable
{
if (safeThis != nullptr && granted)
safeThis->buttonClicked (&safeThis->chooseFileButton);
});
return;
}
if (FileChooser::isPlatformDialogAvailable())
{
fileChooser = std::make_unique<FileChooser> ("Select an audio file...", File(), "*.*");
fileChooser->launchAsync (FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles,
[this] (const FileChooser& fc) mutable
{
if (fc.getURLResults().size() > 0)
{
auto u = fc.getURLResult();
showAudioResource (std::move (u));
}
fileChooser = nullptr;
}, nullptr);
}
else
{
NativeMessageBox::showAsync (MessageBoxOptions()
.withIconType (MessageBoxIconType::WarningIcon)
.withTitle ("Enable Code Signing")
.withMessage ("You need to enable code-signing for your iOS project and enable \"iCloud Documents\" "
"permissions to be able to open audio files on your iDevice. See: "
"https://forum.juce.com/t/native-ios-android-file-choosers"),
nullptr);
}
}
(Note the file filters are changed from “.wav;.flac;.aif" to ".*”)
Then I can select all types of files!
Why is that ? What is wrong. What can I do to solve the “problem”?
–
Eigil