[iOS] Do not pause playing video when application resigns active state.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Jun 2017 21:59:23 +0000 (21:59 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Jun 2017 21:59:23 +0000 (21:59 +0000)
commit58431f1c253353f3c5558c703219359bd97b8957
tree858cdee9f96bfb1c2759a3162bb47389b769c962
parent35e58c2a4c8d0605187aea2d4f2317eee83c6b75
[iOS] Do not pause playing video when application resigns active state.
https://bugs.webkit.org/show_bug.cgi?id=173474

Reviewed by Tim Horton.

Source/WebCore:

Test: media/video-inactive-playback.html

Separate out the concept of "inactive" playback from "process background" playback.
Move the implementation of applicationDidEnterBackground() from MediaSessionManagerIOS
into it's superclass, PlatformMediaSessionManager, and add a new set of restrictions
for "InactiveProcessPlaybackRestricted" and "SuspendedUnderLockPlaybackRestricted".
Leave the default restriction set for iOS as "BackgroundProcessPlaybackRestricted" and
"SuspendedUnderLockPlaybackRestricted", to preserve the existing behavior of suspending
playback when switching apps or when locking the device.

* platform/audio/PlatformMediaSession.cpp:
(WebCore::interruptionName):
* platform/audio/PlatformMediaSession.h:
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive):
(WebCore::PlatformMediaSessionManager::applicationDidBecomeActive):
(WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
(WebCore::PlatformMediaSessionManager::applicationWillEnterForeground):
(WebCore::PlatformMediaSessionManager::applicationWillEnterBackground): Deleted.
(WebCore::PlatformMediaSessionManager::applicationDidEnterForeground): Deleted.
* platform/audio/PlatformMediaSessionManager.h:
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::resetRestrictions):
(-[WebMediaSessionHelper applicationDidBecomeActive:]):
(-[WebMediaSessionHelper applicationWillResignActive:]):
(WebCore::MediaSessionManageriOS::applicationDidEnterBackground): Deleted.
(WebCore::MediaSessionManageriOS::applicationWillEnterForeground): Deleted.
* testing/Internals.cpp:
(WebCore::Internals::applicationWillBecomeInactive):
(WebCore::Internals::applicationDidBecomeActive):
(WebCore::Internals::applicationWillEnterForeground):
(WebCore::Internals::applicationDidEnterBackground):
(WebCore::Internals::setMediaSessionRestrictions):
(WebCore::Internals::applicationDidEnterForeground): Deleted.
(WebCore::Internals::applicationWillEnterBackground): Deleted.
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* media/video-background-playback-expected.txt:
* media/video-background-playback.html:
* media/video-background-tab-playback-expected.txt:
* media/video-background-tab-playback.html:
* media/video-inactive-playback-expected.txt: Added.
* media/video-inactive-playback.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218417 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/media/video-background-playback-expected.txt
LayoutTests/media/video-background-playback.html
LayoutTests/media/video-background-tab-playback-expected.txt
LayoutTests/media/video-background-tab-playback.html
LayoutTests/media/video-inactive-playback-expected.txt [new file with mode: 0644]
LayoutTests/media/video-inactive-playback.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/audio/PlatformMediaSession.cpp
Source/WebCore/platform/audio/PlatformMediaSession.h
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.h
Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h
Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl