Browse Source

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.
v7.0.9
reuk 2 years ago
parent
commit
8b708b348d
No known key found for this signature in database GPG Key ID: FCB43929F012EE5C
2 changed files with 9 additions and 3 deletions
  1. +8
    -3
      examples/Audio/AudioPlaybackDemo.h
  2. +1
    -0
      modules/juce_core/files/juce_common_MimeTypes.cpp

+ 8
- 3
examples/Audio/AudioPlaybackDemo.h 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


+ 1
- 0
modules/juce_core/files/juce_common_MimeTypes.cpp 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" },


Loading…
Cancel
Save