Pick audio from device

First of all: Happy new year!
I recently started playing around with this interesting platform.
And I am stuck with this:
How to pick an audio file (mp3 or wav or ogg) from my device (Windows, android or ios)?
We have a videopicker, an imagepicker, a camerapicker but no audiopicker.
So how do I get a list of audio files on my device. I can’t find any activity to archieve this.

https://pavlenkovv.ru/2022/04/14/легкий-пример-медиапроигрыватель/

Hey, that was really fast help, thanx a lot!
Now I am able to setup a list of audiofiles (file:///C:/audiofiles/audio1.mp3, file:///C:/audiofiles/audio2.mp3… ) and load the files to the audio widget by clicking the item.
But how can I browse through audiofiles on my device( Android or ios) and add them to a playlist ?
It may be difficult because of the read permissions on different Android versions or on ios.

This requires (FilePicker), but as I understand it is not in Flipabit
Для этого требуется (FilePicker), но я так понимаю его нет во Flipabit

this way contains the solution:

With a little change in his code example I can list mp3 files:

import QtQuick 2.15
import Qt.labs.folderlistmodel 2.15
ListView {
width: 200; height: 400
FolderListModel {
id: folderModel
nameFilters: ["*.mp3, *.wav"]
}
Component {
id: fileDelegate
Text { text: fileName }
}
model: folderModel
delegate: fileDelegate
}

все, что получилось
но может получить только файлы png, не знаю по чему

everything that happened
but can only get png files, don’t know why

import QtQuick 2.6
import QtQuick.Window 2.2
import Qt.labs.folderlistmodel 2.1
import QtQuick.Controls 1.4

ListView
{
    id:list;
    anchors.fill: parent;
    anchors.topMargin: btn.height + 20
    anchors.leftMargin: 20
    spacing: 20
    model: FolderListModel
    {
        id:folderList;
        property var folders:[];
        folder:"file:///" + "c://";
                     nameFilters: ["*.pdf","*.png"];
    }
    delegate: Text
    {
        id:wrapper;
        text: fileName
        MouseArea
        {
            id:mos;
            enabled:fileIsDir;
            anchors.fill: parent;
            onClicked:
            {
                folderList.folders.push(folderList.folder);
                folderList.folder += fileName + "/";
            }
        }
    }
}

shouldn’t it be :
nameFilters: ["*.pdf; *.png"];

This is so far my solution for my issue:

import QtQuick 2.2
import QtQuick.Dialogs 1.0

Item {
Connections {
target: document.childByName(“Audio 1”).scriptAdaptor
onEventItemClicked: {
fileDialog.visible = true
}
}
FileDialog {
id: fileDialog
nameFilters: ["*.mp3; *.wav; *.ogg"]
folder: shortcuts.home
onAccepted: {
document.childByName(“Text 1”).content.text = ("" + fileDialog.fileUrls)
}
onRejected: {
}
}
}

Audio picker added in upcoming version.

1 Like

Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.