How to play audio in background with firefox os?
Asked Answered
V

2

7

In my manifest file I've add the audio-channel-content in permissions:

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

In my index.html I've got an audio tag like:

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

I can play my audio stream during 2mn:

  • The first one when the phone is unlock.
  • After 1mn my phone auto-lock the screen and it continue playing for another minute.

Does it possible to play this audio stream more than 1mn after the lock?

Thanks in advance.

Vaas answered 3/6, 2013 at 11:37 Comment(0)
A
0

The code and permission block you have are correct and I can confirm it is working in Firefox OS 1.1. You can also do the whole thing in Javascript:

audio = new Audio();
audio.preload = 'none';
audio.mozAudioChannelType = 'content';
Ambrosial answered 4/10, 2013 at 7:50 Comment(1)
Is Boot2Gecko 1.2.0.0-prerelease equal to Firefox OS 1.2?Vaas
S
0

It's because the wifi is closed after screen shutdown (auto-lock)?

Are you using the dev version of gaia? Wifi is set to always connect in product version.

Seraphine answered 17/10, 2013 at 6:16 Comment(2)
I'm using a geeksphone peak with boot2Gecko 1.2.0.0-prerelease. I don't know if wifi is disconnected on phone lockVaas
1.2.0.0-prerelease is a development version.Seraphine

© 2022 - 2024 — McMap. All rights reserved.