RESOLVED FIXED 127137
[iOS] HTMLMediaSession should set AudioSession category
https://bugs.webkit.org/show_bug.cgi?id=127137
Summary [iOS] HTMLMediaSession should set AudioSession category
Eric Carlson
Reported 2014-01-16 13:08:44 PST
On iOS, an HTMLMediaElement should always set the audio category to "media" so the ringer switch and volume controls do the right thing.
Attachments
Proposed patch (1.90 KB, patch)
2014-01-16 13:27 PST, Eric Carlson
no flags
Eric Carlson
Comment 1 2014-01-16 13:27:21 PST
Created attachment 221406 [details] Proposed patch
Sam Weinig
Comment 2 2014-01-16 22:04:23 PST
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.
Eric Carlson
Comment 3 2014-01-17 10:28:28 PST
(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.
Eric Carlson
Comment 4 2014-01-17 11:34:02 PST
(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".
Eric Carlson
Comment 5 2014-01-17 13:33:38 PST
Note You need to log in before you can comment on or make changes to this bug.