[iOS] AirPlay should not stop when the screen locks
https://bugs.webkit.org/show_bug.cgi?id=148315
<rdar://problem/22770703>

Patch by Eric Carlson <eric.carlson@apple.com> on 2015-10-01
Reviewed by Jer Noble.

Source/WebCore:

Tested by media/video-interruption-with-resume-allowing-play.html
          media/video-interruption-with-resume-not-allowing-play.html

* Modules/webaudio/AudioContext.h: overrideBackgroundPlaybackRestriction -> 
  shouldOverrideBackgroundPlaybackRestriction.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspendPlayback): Fix a typo in the logging.
(WebCore::HTMLMediaElement::mayResumePlayback): Ditto.
(WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction): Renamed from
  overrideBackgroundPlaybackRestriction.
(WebCore::HTMLMediaElement::overrideBackgroundPlaybackRestriction): Deleted.
* html/HTMLMediaElement.h:

* platform/audio/PlatformMediaSession.cpp:
(WebCore::stateName):
(WebCore::interruptionName): New, log the name of the interruption.
(WebCore::PlatformMediaSession::beginInterruption): Log the interruption type. Don't
  increment the interruption counter if we are going to ignore it. Incorporate logic
  from doInterruption.
(WebCore::PlatformMediaSession::doInterruption): Deleted.
(WebCore::PlatformMediaSession::shouldDoInterruption): Deleted.
(WebCore::PlatformMediaSession::forceInterruption): Deleted.

* platform/audio/PlatformMediaSession.h: Add SuspendedUnderLock interruption type.
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::applicationDidEnterBackground): Deleted.
* platform/audio/PlatformMediaSessionManager.h:

* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::applicationDidEnterBackground): Call beginInterruption
  when appropriate.

LayoutTests:

* media/video-interruption-with-resume-allowing-play.html:
* media/video-interruption-with-resume-not-allowing-play.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@190434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/media/video-interruption-with-resume-allowing-play.html b/LayoutTests/media/video-interruption-with-resume-allowing-play.html
index 6b53702..c5cb4dc 100644
--- a/LayoutTests/media/video-interruption-with-resume-allowing-play.html
+++ b/LayoutTests/media/video-interruption-with-resume-allowing-play.html
@@ -12,7 +12,7 @@
                 case "playing":
                     testExpected("video.paused", false);
                     state = "interrupted";
-                    run("internals.beginMediaSessionInterruption()");;
+                    run("internals.beginMediaSessionInterruption('System')");;
                     setTimeout(checkState, 100);
                     consoleWrite("");
                     break;