[iOS] pause video when a tab moves to the background on some devices
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2015 19:19:44 +0000 (19:19 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2015 19:19:44 +0000 (19:19 +0000)
commit17472a7f39c03f0b3b10f933dd2b52116ccf4ce4
tree81b396b42e235fef91cf51f5127afd80ad51a1d6
parent2cd57bbc4da7f7a3e918488f3751dca9b5c0ceae
[iOS] pause video when a tab moves to the background on some devices
https://bugs.webkit.org/show_bug.cgi?id=141753
<rdar://problem/19814562>

Reviewed by Jer Noble.

Source/WebCore:

Test: media/video-background-tab-playback.html

* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::clientDataBufferingTimerFired): Pause video when the element becomes
    hidden if the BackgroundTabPlaybackRestricted is set.

* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::applicationWillEnterBackground): Rename BackgroundPlaybackNotPermitted
     to BackgroundProcessPlaybackRestricted.
(WebCore::MediaSessionManager::applicationWillEnterForeground): Ditto.
* platform/audio/MediaSessionManager.h:

* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::resetRestrictions): Set BackgroundTabPlaybackRestricted on
    devices with restricted memory. BackgroundPlaybackNotPermitted -> BackgroundProcessPlaybackRestricted.

* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Add support for BackgroundTabPlaybackRestricted.
    BackgroundPlaybackNotPermitted -> BackgroundProcessPlaybackRestricted.

LayoutTests:

* media/video-background-playback-expected.txt: BackgroundPlaybackNotPermitted -> BackgroundProcessPlaybackRestricted.
* media/video-background-playback.html: Ditto.
* media/video-background-tab-playback-expected.txt: Added.
* media/video-background-tab-playback.html: Added.

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