Media: notify clients when autoplayed media ends without being paused
authormrajca@apple.com <mrajca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Feb 2017 19:42:20 +0000 (19:42 +0000)
committermrajca@apple.com <mrajca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Feb 2017 19:42:20 +0000 (19:42 +0000)
commit6ff3e0db93024c031f28967fde38da1b010aeeff
tree929685e1e0734a62267082d2c045cbdf315413bb
parent62e97d7a5ecab64527fcb9e021e25036b03f2c2a
Media: notify clients when autoplayed media ends without being paused
https://bugs.webkit.org/show_bug.cgi?id=168852

Reviewed by Alex Christensen.

Source/WebCore:

Added API tests.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setReadyState):
 Set state accordingly if we autoplayed or if playback was prevented.
(WebCore::HTMLMediaElement::play):
 Update state if playback was prevented.
(WebCore::HTMLMediaElement::playInternal):
 Update state if playback began without user interaction.
(WebCore::HTMLMediaElement::pauseInternal):
 Update state.
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
 If playback ends and it began without user interaction, send a DidPlayMediaWithoutInterference event.
(WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
* html/HTMLMediaElement.h:
* page/AutoplayEvent.h:

Source/WebKit2:

* UIProcess/API/C/WKPageUIClient.h:

Tools:

* TestWebKitAPI/Tests/WebKit2/js-play-with-controls.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
(TEST): Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213161 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/page/AutoplayEvent.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPageUIClient.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2/js-play-with-controls.html
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm