On iOS, an HTMLMediaElement should always set the audio category to "media" so the ringer switch and volume controls do the right thing.
Created attachment 221406 [details] Proposed patch
Comment on attachment 221406 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=221406&action=review > Source/WebCore/html/HTMLMediaSession.cpp:58 > +#if PLATFORM(IOS) > +static void initializeAudioSession() > +{ > + static bool wasAudioSessionInitialized; > + if (wasAudioSessionInitialized) > + return; > + > + wasAudioSessionInitialized = true; > + if (!WebCore::applicationIsMobileSafari()) > + return; > + > + AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback); > +} > +#endif Why do we only want to do this on iOS (and only in MobileSafari)? > Source/WebCore/html/HTMLMediaSession.cpp:71 > +#if PLATFORM(IOS) > + initializeAudioSession(); > +#endif I would rather we always call this, and have it do nothing on platforms that don't need it.
(In reply to comment #2) > (From update of attachment 221406 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=221406&action=review > > > Source/WebCore/html/HTMLMediaSession.cpp:58 > > +#if PLATFORM(IOS) > > +static void initializeAudioSession() > > +{ > > + static bool wasAudioSessionInitialized; > > + if (wasAudioSessionInitialized) > > + return; > > + > > + wasAudioSessionInitialized = true; > > + if (!WebCore::applicationIsMobileSafari()) > > + return; > > + > > + AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback); > > +} > > +#endif > > Why do we only want to do this on iOS (and only in MobileSafari)? > 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. > > Source/WebCore/html/HTMLMediaSession.cpp:71 > > +#if PLATFORM(IOS) > > + initializeAudioSession(); > > +#endif > > I would rather we always call this, and have it do nothing on platforms that don't need it. > OK, I will fix this in a follow-up.
(In reply to comment #3) > (In reply to comment #2) > > I would rather we always call this, and have it do nothing on platforms that don't need it. > > > OK, I will fix this in a follow-up. By which I meant "I will fix this when I check in".
Committed r162221: http://trac.webkit.org/changeset/162221