How can I play an mp3 file from my application in the background?

I am making a podcast management application for Firefox OS. So far, I've managed to download the files and save them to the SD card. For playback, I am using MozActivity because I want the file to play in my installed music player.

Here's the code to reproduce:

var activity = new MozActivity({

    name: "open",

    data: {
      type: [
      // here I pass the file blob
      blob: data


The problem is that when I put an application in the background to open another, playback stops and the music player closes.

Another thing I would like to do is when I play again a file that I haven't finished listening to, to resume playing from the minute I left it.


source to share

1 answer

The solution was to add this to the manifest file

"permissions": {
    "audio-channel-content": {
      "description": "Required to play audio in the background."




All Articles