Audio can not play when headphone connected

RESOLVED WONTFIX

Status

Firefox OS
AudioChannel
RESOLVED WONTFIX
3 years ago
2 months ago

People

(Reporter: Viga, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
Created attachment 8676114 [details]
sample.audio-touchscreen.zip

this.alarmContext = new AudioContext('alarm');
    this.normalContext = new AudioContext('normal');
3.5mm headphone connected, when play audio via normalContext.
No audio play neither from speaker, nor from the headphone.
Please see the sample code attached
(Reporter)

Updated

3 years ago
Flags: needinfo?(wehuang)
Hi, Viga,
When the alarm type stream (STRATEGY_SONIFICATION) is active, Android would mute all music stream (STRATEGY_MEDIA).
It's not a bug, it's Android's design.

The audio stream is created at the same time when you created an AudioContext.
Therefore, you should not create an "alarm" type AudioContext if you want to play something from "normal" type AudioContext.
(Reporter)

Comment 2

3 years ago
Alastor: I test open gaia 2.2. with 3.5mm headphone plugged in. First play alarm in clock App(its using AudioContext alarm channel) sound come out from headphone and speaker. Then I press home button, then launch dialer, I can hear sound coming from headphone.  
From log I can see, When AudioContext channel set to alarm

out_snd_device(5:speaker-and-headphones) is selected, and you can only play in this channel,
If you want to play content channel, you have to release alarm AudioContext first. Then,
The channel change to out_snd_device(2: speaker).

My question is, For clock and dialer keypad, clock can play in alarm channel, and still keypad tone can be played, how to release alamr AudioContext in clock app?
Flags: needinfo?(alwu)
Blocks: 1191703
Flags: needinfo?(wehuang)
When the alarm is playing, you should not hear the normal/content type audio at the same time.
If you want to hear the dialer sound at that time, you should change its audio channel type to "system".
(Reporter)

Comment 4

3 years ago
(In reply to Alastor Wu [:alwu] from comment #1)
> Hi, Viga,
> When the alarm type stream (STRATEGY_SONIFICATION) is active, Android would
> mute all music stream (STRATEGY_MEDIA).
> It's not a bug, it's Android's design.
> 
> The audio stream is created at the same time when you created an
> AudioContext.
> Therefore, you should not create an "alarm" type AudioContext if you want to
> play something from "normal" type AudioContext.

pre-condition with 3.5mm headphone plugged in.
When I first new AudioContext('content') and play the sound it's working(ONLY from headphone). Then I new AudioContext('alarm') and play sound, it's working(from both headphone and speaker), but, then I play sound AudioContext('content') again. No sound played.
Remove NI, we have discussed this issue in IRC.
Flags: needinfo?(alwu)

Comment 6

2 months ago
Firefox OS is not being worked on
Status: NEW → RESOLVED
Last Resolved: 2 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.