Also note that if your are using B2G desktop or extension,
you might want to know which folder you should put the songs in.
Just put your media files in /YOUR_HOME_DIRECTORY/Music,
(For video and pictures, /YOUR_HOME_DIRECTORY/Pictures or Videos)
then you can get the songs by using DeviceStorage API.
This should work for both OSX and Ubuntu.

Dominic

----- Original Message -----
From: "Jonas Sicking" <[email protected]>
To: [email protected]
Cc: [email protected]
Sent: Friday, December 28, 2012 10:13:51 AM
Subject: Re: [b2g] B2G Media API(Fetch user's song)

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

Reply via email to