How to play audio in background using firefox os?

In my manifest file, I add audio channel content in permissions:

"permissions": { "audio-channel-content":{"description":"Use the audio channel for the music player"} } 

In my index.html, I have a sound tag like:

 <audio mozaudiochannel="content" preload="none" src="http://my-stream-url"></audio> 

I can play my audio stream during 2mn:

  • The first is when the phone unlocks.
  • After 1 minute, my phone will automatically lock the screen and it will continue playing for another minute.

Can I play this audio stream more than 1 million after blocking?

Thanks in advance.

+7
source share
2 answers

You have the correct code and permission block, and I can confirm that it works in Firefox OS 1.1. You can also do all this in Javascript:

 audio = new Audio(); audio.preload = 'none'; audio.mozAudioChannelType = 'content'; 
0
source

Is it because Wi-Fi closes after turning off the screen (auto-lock)?

Are you using the dev version of gaia? Wi-Fi is configured to always connect in the product version.

0
source

All Articles