X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=Source%2FWebCore%2Fhtml%2FHTMLMediaSession.cpp;h=2fd037fdf913cbd0048195d9fdf0cc7fd15f89ab;hp=36c21b1136e401b64c56c899440e496bbfe12363;hb=fadd9acfe15b5226ee8f3b8e2fa491cea6f844a8;hpb=7957557e2ee03c95e959fc8ce1c7b42b6e98d1c5 diff --git a/Source/WebCore/html/HTMLMediaSession.cpp b/Source/WebCore/html/HTMLMediaSession.cpp index 36c21b1136e4..2fd037fdf913 100644 --- a/Source/WebCore/html/HTMLMediaSession.cpp +++ b/Source/WebCore/html/HTMLMediaSession.cpp @@ -36,11 +36,27 @@ #include "ScriptController.h" #if PLATFORM(IOS) +#include "AudioSession.h" #include "RuntimeApplicationChecksIOS.h" #endif namespace WebCore { +static void initializeAudioSession() +{ +#if PLATFORM(IOS) + static bool wasAudioSessionInitialized; + if (wasAudioSessionInitialized) + return; + + wasAudioSessionInitialized = true; + if (!WebCore::applicationIsMobileSafari()) + return; + + AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback); +#endif +} + std::unique_ptr HTMLMediaSession::create(MediaSessionClient& client) { return std::make_unique(client); @@ -50,6 +66,7 @@ HTMLMediaSession::HTMLMediaSession(MediaSessionClient& client) : MediaSession(client) , m_restrictions(NoRestrictions) { + initializeAudioSession(); } void HTMLMediaSession::addBehaviorRestriction(BehaviorRestrictions restriction) @@ -99,7 +116,7 @@ bool HTMLMediaSession::pageAllowsDataLoading(const HTMLMediaElement& element) co LOG(Media, "HTMLMediaSession::pageAllowsDataLoading - returning FALSE"); return false; } - + return true; } @@ -110,7 +127,7 @@ bool HTMLMediaSession::pageAllowsPlaybackAfterResuming(const HTMLMediaElement& e LOG(Media, "HTMLMediaSession::pageAllowsPlaybackAfterResuming - returning FALSE"); return false; } - + return true; } @@ -121,7 +138,7 @@ bool HTMLMediaSession::showingPlaybackTargetPickerPermitted(const HTMLMediaEleme LOG(Media, "HTMLMediaSession::showingPlaybackTargetPickerPermitted - returning FALSE"); return false; } - + return true; } #endif