Hi there,
I would like to read a playlist .pls file to tell Audio what music to play but I cannot get QFile to read it. My application shall be an Sailfish app.
To read a file I followed this tutorial.
If I use this code with source: "qrc:/playlist.pls" (currently I provide the playlist within my resource file)
FileIO {
id: myFile
source: "my_file.txt"
onError: console.log(msg)
}
FileIO {
id: myFile
source: "my_file.txt"
onError: console.log(msg)
}
To copy to clipboard, switch view to plain text mode
I get this error:
[W] unknown:39 - file:///usr/share/Test/qml/Test.qml:39:30: Type FirstPage unavailable
initialPage: Component { FirstPage { } }
^
[W] unknown:57 - file:///usr/share/Test/qml/pages/FirstPage.qml:57:21: Invalid property assignment: "source" is a read-only property
source: "qrc:/playlist.pls"
[W] unknown:39 - file:///usr/share/Test/qml/Test.qml:39:30: Type FirstPage unavailable
initialPage: Component { FirstPage { } }
^
[W] unknown:57 - file:///usr/share/Test/qml/pages/FirstPage.qml:57:21: Invalid property assignment: "source" is a read-only property
source: "qrc:/playlist.pls"
To copy to clipboard, switch view to plain text mode
I do not understand that because I only want to open the file as read-only, so why is the string invalid?
Then I commented the source out and put the path directly into the cpp file.
...
mSource = "qrc:/playlist.pls";
if (mSource.isEmpty()){
...
...
mSource = "qrc:/playlist.pls";
if (mSource.isEmpty()){
...
To copy to clipboard, switch view to plain text mode
Then the file could be opened but not read and I get the error message:
[D] onError:58 - Unable to open the file
[D] onCompleted:125 -
[D] onError:58 - Unable to open the file
[D] onCompleted:125 -
To copy to clipboard, switch view to plain text mode
I spend nearly to days now to figure out what is wrong but I just cannot find anything on the web. Can someone help me please?
Bookmarks