<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23505</bug_id>
          
          <creation_ts>2013-10-14 20:13:36 +0000</creation_ts>
          <short_desc>&lt;video&gt;: a mechanism by which pages can indicate if their audio should play in the background</short_desc>
          <delta_ts>2015-09-16 11:24:36 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Needs Impl Interest</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ian &apos;Hixie&apos; Hickson">ian</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>philipj</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94696</commentid>
    <comment_count>0</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-14 20:13:36 +0000</bug_when>
    <thetext>On Fri, 15 Mar 2013, Wesley Johnston wrote:
&gt;
&gt; In most situations, when the user puts a webpage in the background, any
&gt; media being played by the page should be paused. Any attempts to play
&gt; audio by a background page should also be prevented. However, for some
&gt; sites (music or radio apps) the user would like to continue to hear the
&gt; app while they do something else. These pages should be able to
&gt; designate their audio as a type that should keep playing while in the
&gt; background. The useragent should also attempt to avoid having the stream
&gt; killed by the operating system if possible. This is especially true on
&gt; mobile devices, but the problem is also already prevalent on desktop.
&gt;
&gt; I think semantically we need a way to describe to the useragent how to
&gt; play a particular track. I&apos;d suggest we add an optional attribute to
&gt; media elements, &quot;audiochannel&quot;, designating the output and priority of
&gt; this audio. The channel attribute can potentially take on three
&gt; different values. &quot;normal&quot;, &quot;background&quot;, and &quot;telephony&quot;.
&gt;
&gt; &quot;normal&quot; channels are the default for all media elements. Using them
&gt; doesn&apos;t require any special permissions. Audio playing with these
&gt; channels is paused when the web page moves into the background. In
&gt; addition, calling play on an media element with this channel while in
&gt; the background will put the element into the paused for user interaction
&gt; state (i.e. playback won&apos;t start until the webapp is brought to the
&gt; foreground)?
&gt;
&gt; &quot;background&quot; channels will continue to play when the page is put into
&gt; the background. Trying to play a background channel while in the
&gt; background should also work. The ability to play audio on this channel
&gt; may require requesting permission from the UA first (i.e. possibly a
&gt; prompt when the audio is first played or when moving to the background).
&gt; If the user doesn&apos;t grant permission, these should throw a MediaError
&gt; (MEDIA_ERR_CHANNEL_PERMISSION_NOT_GRANTED?) so that the page can know
&gt; what has happened and do something appropriate.
&gt;
&gt; &quot;telephony&quot; channels are similar to &quot;background&quot; channels and can play
&gt; even if the page is in the background. Playing audio on a telephony
&gt; channel may cause any audio playing on &quot;normal&quot; or &quot;background&quot; channels
&gt; to be paused or have their volume severely decreased. They also, on
&gt; devices where its supported, will likely play over handset speakers
&gt; rather than normal speakers. Similar to &quot;background&quot;, these may require
&gt; permission from the UA.
&gt;
&gt; Note: This is all based rather loosely on the AudioChannels
&gt; implementation written for B2G recently [1]. It includes a few other
&gt; use-cases on its wiki page, along with definitions of additional
&gt; channels to accomadate them. I&apos;ve been trying to simplify it down to
&gt; handle the most common use cases. Finding the correct terminology here
&gt; is difficult though. For instance, it seems likely that games will see
&gt; the background channel and think its an appropriate place to play game
&gt; background music, the exact type of audio you&apos;d like to have paused when
&gt; you leave the game. Ideas for better ways to describe it are welcome.
&gt;
&gt; [1] https://wiki.mozilla.org/WebAPI/AudioChannels

On Sat, 16 Mar 2013, James Ross wrote:
&gt;
&gt; For comparison, Windows 8 defines msAudioCategory
&gt; (http://msdn.microsoft.com/en-us/library/windows/apps/hh767375) with
&gt; similar channels to the B2G list, but also a separate msAudioDeviceType
&gt; (http://msdn.microsoft.com/en-us/library/windows/apps/hh767376) which
&gt; specifies which device to output to (console - not sure what this means,
&gt; multimedia, communications).

On Wed, 10 Apr 2013, SULLIVAN, BRYAN L wrote:
&gt;
&gt; There are other use cases (e.g. a web-based tutorial or help system, intended 
&gt; to guide the user in using other apps or device features) which will need 
&gt; background audio capability.
&gt;
&gt; I&apos;m not sure about the permissions based approach though. The number of
&gt; things that the user has to explicitly allow and manage seems to be
&gt; steadily increasing. Audio seems a fairly innocuous thing that I think
&gt; should be able to run in the background without any special permission.
&gt; The user always has the choice to not use the app if it doesn&apos;t offer
&gt; (or act upon) app-based controls on background audio use.

On Wed, 10 Apr 2013, Chris Wilson wrote:
&gt;
&gt; Changing the default behavior of media elements today seems problematic;
&gt; all current &lt;audio&gt; elements, under this proposal, would start pausing when
&gt; you switched away from the tab.  Additionally, this isn&apos;t just media
&gt; elements - it needs to also affect Web Audio, as well as any plugins.  That
&gt; becomes a lot more problematic as well.

On Wed, 10 Apr 2013, Chris Wilson wrote:
&gt;
&gt; The problem [pages] CAN&apos;T solve is the telephony one - intelligently pausing
&gt; sounds when a phone call comes in.  I would have expected a design that was
&gt; more like firing an event on the window that asks the app to pause all
&gt; playing audio - and in fact, I might want a video stream to go on playing
&gt; visually, but not audibly, or I might want a live stream to have its volume
&gt; reduced, but not shut off.  The default handling of this event could be to
&gt; forcibly pause all media elements, and even forcibly mute sounds playing
&gt; from Web Audio and plugins; but that handling could easily be prevented by
&gt; my app that knows it should pause the sequencing. Or something like that [...]

This topic was relatively controversial, and only selected positive comments are included above. For the full story, see the feedback here:

   http://lists.w3.org/Archives/Public/public-html/2013Apr/thread.html#msg49</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94700</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-14 20:24:00 +0000</bug_when>
    <thetext>On Fri, 5 Apr 2013, Mounir Lamouri wrote:
&gt;
&gt; The channel attribute gives a hint about the type of channel the author
&gt; is expecting the UA to use. It is an enumerated attribute that uses the
&gt; following keywords and states:
&gt;
&gt; Keyword: media
&gt; State: Foreground Media
&gt; Fallback: none
&gt; Description: To be used for media element that wants to play basic media
&gt; such as an audio or video stream that should be paused when the page is
&gt; put in the background.
&gt;
&gt; Keyword: background-media
&gt; State: Background Media
&gt; Fallback: Foreground Media
&gt; Description: To be used for media element that wants to play basic media
&gt; such as an audio or video stream that should not be paused when the page
&gt; is put in the background. Music, podcast or radio players are expected
&gt; to use this state.
&gt;
&gt; Keyword: effects
&gt; State: Effects
&gt; Fallback: Foreground Media
&gt; Description: To be used for media element that creates short and quick
&gt; effects such as button click, game effects. It is intended to be used
&gt; for effects that are being heard while using the page, not for
&gt; notifications. When on this state, the media should use a low latency
&gt; channel.
&gt;
&gt; Keyword: notification
&gt; State: Notification
&gt; Fallback: effects
&gt; Description: Like the effects state, this intends to be used for short
&gt; and quick media but that require to catch user attention whether the
&gt; page is currently visible or not. For example, this state could be used
&gt; for a sound notification when there is a new email in the user&apos;s inbox.
&gt;
&gt; Keyword: communication
&gt; State: Communication
&gt; Fallback: Background Media
&gt; Description: To be used for media element that transmits real time
&gt; communication such as phone calls or VOIP. When on this state, the media
&gt; should use a low latency channel.
&gt;
&gt; Keyword: alarm
&gt; State: Alarm
&gt; Fallback: Notification
&gt; Description: To be used for media element that wants to make sure to be
&gt; played even if the device is currently muted. Typical use case would be
&gt; an alarm clock.

The above is an extract from:
   http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Apr/0026.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123222</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-09-16 09:54:38 +0000</bug_when>
    <thetext>Philip, this is the Media Session Standard, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123225</commentid>
    <comment_count>3</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-09-16 11:24:36 +0000</bug_when>
    <thetext>Yes, the use cases described are what https://mediasession.spec.whatwg.org/ is trying to solve, so I&apos;ll resolve this as moved. Further feedback in this area should be directed to https://github.com/whatwg/mediasession/issues</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>