||We use `AudibleState` to represent the audible state of an owner of audio
channel agent. Those information in AudioChannelWindow could help us to
determine if a tab is being audible or not, in order to tell Chrome JS to
show the sound indicator or delayed autoplay icon on the tab bar.
- Sound indicator
When a tab is playing sound, we would show the sound indicator on tab bar
to tell users that this tab is producing sound now. In addition, the sound
indicator also give users an ablility to mute or unmute tab.
When an AudioChannelWindow first contains an agent with state `eAudible`,
or an AudioChannelWindow losts its last agent with state `eAudible`, we
would notify Chrome JS about those changes, to tell them that a tab has
been being audible or not, in order to display or remove the indicator for
a corresponding tab.
- Delayed autoplay icon (Play Tab icon)
When we enable delaying autoplay, which is to postpone the autoplay media
for unvisited tab until it first goes to foreground, or user click the
play tab icon to resume the delayed media.
When an AudioChannelWindow first contains an agent with state `eAudible` or
`eMaybeAudible`, we would notify Chrome JS about this change, in order to
show the delayed autoplay tab icon to user, which is used to notice user
there is a media being delayed starting, and then user can click the play
tab icon to resume the start of media, or visit that tab to resume delayed
According to our UX design, we don't show this icon for inaudible media.
The reason of showing the icon for a tab, where the agent starts with state
`eMaybeAudible`, is because some video might be silent in the beginning
but would soon become audible later.
eNotAudible : agent is not audible
eMaybeAudible : agent is not audible now, but it might be audible later
eAudible : agent is audible now
||The suspended enum is used for delaying autoplay video in non-visited tab
Note: the "remote side" must control the AudioChannelAgent using
nsIAudioChannelAgentCallback.windowSuspendChanged() callback instead using
play/pause methods or any button in the webpage.
It's used to prevent auto-playing media in inactive page in order to
reduce the power consumption, and the media can't be resumed until the
page becomes active again. It would change the internal state of
MediaElement when it's being blocked/resumed, so it won't trigger the
related JS event. eg. "play" and "pause" event.