[Audio] nsHTMLAudioElement::mozWriteAudio() doesn't join AudioChannelService.

RESOLVED INVALID

Status

Firefox OS
General
RESOLVED INVALID
5 years ago
5 years ago

People

(Reporter: mchen, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
We need all of audio playing path to join audio channel service, but the path from the nsHTMLAudioElement::mozWriteAudio() not.
(Reporter)

Comment 1

5 years ago
I found a issue on implementation stage and that is
  1. I can put AudioChannelAgent::StartPlaying() in first time of calling mozWriteAudio().
  2. But I can't find any point to put AudioChannelAgent::StopPlaying().

This sort of APIs related to mozWriteAudio() which didn't design an one for pausing / closing nsAudioStream which is setup by mozSetup(). So there is no point to know when should I call AudioChannelAgent::StopPlaying().

Hi Robert,

Could you give some suggestion for this?
Very thanks.
Flags: needinfo?(roc)
pause() on the element would trigger StopPlaying, right? That should be enough.
Flags: needinfo?(roc)
(Reporter)

Comment 3

5 years ago
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #2)
> pause() on the element would trigger StopPlaying, right? That should be
> enough.

Hi Robert,

Thanks for your response here.

Refer to keypad.js from dialer app, it created a audio tag then firing key tone by mozWriteAudio(). In that case it didn't call any audio.pause(). I don't know whether that is a common usage or that is a bug. If that is a bug then I can put stop point at pause().

https://github.com/mozilla-b2g/gaia/blob/master/apps/communications/dialer/js/keypad.js#L95
The question is whether we can or should automatically detect when to call StopPlaying() for an application that is using the Audio Data API.

I suppose we could do it automatically if mozWriteAudio hasn't been called for some period of time, e.g. 2 seconds.

However, I think it should also be fine to not detect that automatically, and require that applications using the Audio Data API call pause() to indicate that they've paused. The Audio Data API is deprecated and I think very few applications are or should be using it. So I think it's probably not worth adding more code for it.
(Reporter)

Comment 5

5 years ago
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #4)
> The question is whether we can or should automatically detect when to call
> StopPlaying() for an application that is using the Audio Data API.
> 

Ok, there is only key tone from dialer app used this function. Wait for real issue occurred then just implementing it.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.