1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

AudioPlaybackDemo: Fix usability issues on Android

Android devices won't necessarily be able to load MP3 files, so that
option has been removed from the file chooser. FLAC files should be
supported, but were missing from the MIME table.

The demo no longer tries to load files into the thumbnail view if they
previously failed to load into the transport.
This commit is contained in:
reuk 2023-02-27 14:52:30 +00:00
parent 36627a2216
commit 8b708b348d
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 9 additions and 3 deletions

View file

@ -415,9 +415,14 @@ private:
//==============================================================================
void showAudioResource (URL resource)
{
if (loadURLIntoTransport (resource))
currentAudioFile = std::move (resource);
if (! loadURLIntoTransport (resource))
{
// Failed to load the audio file!
jassertfalse;
return;
}
currentAudioFile = std::move (resource);
zoomSlider.setValue (0, dontSendNotification);
thumbnail->setURL (currentAudioFile);
}
@ -492,7 +497,7 @@ private:
if (FileChooser::isPlatformDialogAvailable())
{
fileChooser = std::make_unique<FileChooser> ("Select an audio file...", File(), "*.wav;*.mp3;*.aif");
fileChooser = std::make_unique<FileChooser> ("Select an audio file...", File(), "*.wav;*.flac;*.aif");
fileChooser->launchAsync (FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles,
[this] (const FileChooser& fc) mutable

View file

@ -206,6 +206,7 @@ private:
{ "fdf", "application/vnd.fdf" },
{ "fif", "application/fractals" },
{ "fif", "image/fif" },
{ "flac", "audio/flac" },
{ "fli", "video/fli" },
{ "fli", "video/x-fli" },
{ "flo", "image/florian" },