Also note that your app will need to have appropriate permissions to use
the device storage API. I've only worked on core Gaia apps, so I don't
know how permissions work for third-party apps.
Also, the Music app stores statistics like the user's rating and how
many times the songs have been listened to. But it keeps that
information in a private database and does not write it back into the
metadata of the audio file. Your app will have no way to read the music
app's database, so you can't find out which songs are the mostly
frequently played.
David Flanagan
On 12/27/12 6:13 PM, Jonas Sicking wrote:
On Wed, Dec 26, 2012 at 2:47 PM, <[email protected]> wrote:
So i am trying to develop a app and i need to get every single song that the
user has and how often they listen to each one and other sorts of statistics,
but mainly just get the songs into my app. I am using the B2G extension for
Firefox Browser. How can i do that?
You can use the DeviceStorage API [1] to get the "music" folder and
enumerate all the files in that folder.
The resulting code would look something like:
var music = navigator.getDeviceStorage("music");
var musicBlobs = [];
var enum = music.enumerate();
enum.onsuccess = function(e) {
blob = enum.result;
if (!blob) {
return; // done enumerating
}
musicBlobs.push(blob);
enum.continue();
}
[1] https://wiki.mozilla.org/WebAPI/DeviceStorageAPI
/ Jonas
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g