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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>127137</bug_id>
          
          <creation_ts>2014-01-16 13:08:44 -0800</creation_ts>
          <short_desc>[iOS] HTMLMediaSession should set AudioSession category</short_desc>
          <delta_ts>2014-01-17 13:33:48 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Media</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Carlson">eric.carlson</reporter>
          <assigned_to name="Eric Carlson">eric.carlson</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>glenn</cc>
    
    <cc>gyuyoung.kim</cc>
    
    <cc>jer.noble</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>968894</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2014-01-16 13:08:44 -0800</bug_when>
    <thetext>On iOS, an HTMLMediaElement should always set the audio category to &quot;media&quot; so the ringer switch and volume controls do the right thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>968903</commentid>
    <comment_count>1</comment_count>
      <attachid>221406</attachid>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2014-01-16 13:27:21 -0800</bug_when>
    <thetext>Created attachment 221406
Proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969042</commentid>
    <comment_count>2</comment_count>
      <attachid>221406</attachid>
    <who name="Sam Weinig">sam</who>
    <bug_when>2014-01-16 22:04:23 -0800</bug_when>
    <thetext>Comment on attachment 221406
Proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=221406&amp;action=review

&gt; Source/WebCore/html/HTMLMediaSession.cpp:58
&gt; +#if PLATFORM(IOS)
&gt; +static void initializeAudioSession()
&gt; +{
&gt; +    static bool wasAudioSessionInitialized;
&gt; +    if (wasAudioSessionInitialized)
&gt; +        return;
&gt; +
&gt; +    wasAudioSessionInitialized = true;
&gt; +    if (!WebCore::applicationIsMobileSafari())
&gt; +        return;
&gt; +
&gt; +    AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback);
&gt; +}
&gt; +#endif

Why do we only want to do this on iOS (and only in MobileSafari)?

&gt; Source/WebCore/html/HTMLMediaSession.cpp:71
&gt; +#if PLATFORM(IOS)
&gt; +    initializeAudioSession();
&gt; +#endif

I would rather we always call this, and have it do nothing on platforms that don&apos;t need it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969165</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2014-01-17 10:28:28 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 221406 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=221406&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/html/HTMLMediaSession.cpp:58
&gt; &gt; +#if PLATFORM(IOS)
&gt; &gt; +static void initializeAudioSession()
&gt; &gt; +{
&gt; &gt; +    static bool wasAudioSessionInitialized;
&gt; &gt; +    if (wasAudioSessionInitialized)
&gt; &gt; +        return;
&gt; &gt; +
&gt; &gt; +    wasAudioSessionInitialized = true;
&gt; &gt; +    if (!WebCore::applicationIsMobileSafari())
&gt; &gt; +        return;
&gt; &gt; +
&gt; &gt; +    AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback);
&gt; &gt; +}
&gt; &gt; +#endif
&gt; 
&gt; Why do we only want to do this on iOS (and only in MobileSafari)?
&gt; 
AudioSession only has category support on iOS. We only set the category in MobileSafari because apps using a UIWebView may need to use another category, and can do so with the UIWebView.

&gt; &gt; Source/WebCore/html/HTMLMediaSession.cpp:71
&gt; &gt; +#if PLATFORM(IOS)
&gt; &gt; +    initializeAudioSession();
&gt; &gt; +#endif
&gt; 
&gt; I would rather we always call this, and have it do nothing on platforms that don&apos;t need it.
&gt;
OK, I will fix this in a follow-up.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969178</commentid>
    <comment_count>4</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2014-01-17 11:34:02 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; I would rather we always call this, and have it do nothing on platforms that don&apos;t need it.
&gt; &gt;
&gt; OK, I will fix this in a follow-up.

By which I meant  &quot;I will fix this when I check in&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969247</commentid>
    <comment_count>5</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2014-01-17 13:33:38 -0800</bug_when>
    <thetext>Committed r162221: http://trac.webkit.org/changeset/162221</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>221406</attachid>
            <date>2014-01-16 13:27:21 -0800</date>
            <delta_ts>2014-01-17 13:33:48 -0800</delta_ts>
            <desc>Proposed patch</desc>
            <filename>audio_session_2.txt</filename>
            <type>text/plain</type>
            <size>1947</size>
            <attacher name="Eric Carlson">eric.carlson</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSB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