Title: [203984] trunk/Source/WebCore
Revision
203984
Author
[email protected]
Date
2016-08-01 13:48:35 -0700 (Mon, 01 Aug 2016)

Log Message

[iOS] A video element that does not pause after exiting from fullscreen should be allowed to continue playing inline
https://bugs.webkit.org/show_bug.cgi?id=160416
<rdar://problem/27409854>

Reviewed by Alex Christensen.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::exitFullscreen): If playback normally requires fullscreen but the
element was not paused when exiting from fullscreen, set the 'playsinline' attribute so we won't
force fullscreen if playback is paused and resumes, and set the 'controls' attribute so the
user can control playback.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (203983 => 203984)


--- trunk/Source/WebCore/ChangeLog	2016-08-01 20:34:02 UTC (rev 203983)
+++ trunk/Source/WebCore/ChangeLog	2016-08-01 20:48:35 UTC (rev 203984)
@@ -1,3 +1,17 @@
+2016-08-01  Eric Carlson  <[email protected]>
+
+        [iOS] A video element that does not pause after exiting from fullscreen should be allowed to continue playing inline
+        https://bugs.webkit.org/show_bug.cgi?id=160416
+        <rdar://problem/27409854>
+
+        Reviewed by Alex Christensen.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::exitFullscreen): If playback normally requires fullscreen but the 
+        element was not paused when exiting from fullscreen, set the 'playsinline' attribute so we won't
+        force fullscreen if playback is paused and resumes, and set the 'controls' attribute so the
+        user can control playback.
+
 2016-08-01  Anders Carlsson  <[email protected]>
 
         Build fix.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (203983 => 203984)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-08-01 20:34:02 UTC (rev 203983)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-08-01 20:48:35 UTC (rev 203984)
@@ -5463,19 +5463,29 @@
 #endif
     if (hasMediaControls())
         mediaControls()->exitedFullscreen();
-    if (document().page() && is<HTMLVideoElement>(*this)) {
-        if (m_mediaSession->requiresFullscreenForVideoPlayback(*this) && (!document().settings() || !document().settings()->allowsInlineMediaPlaybackAfterFullscreen() || isVideoTooSmallForInlinePlayback()))
+
+    if (!document().page() || !is<HTMLVideoElement>(*this))
+        return;
+
+    if (!paused() && m_mediaSession->requiresFullscreenForVideoPlayback(*this)) {
+        if (!document().settings() || !document().settings()->allowsInlineMediaPlaybackAfterFullscreen() || isVideoTooSmallForInlinePlayback())
             pauseInternal();
+        else {
+            // Allow inline playback, but set 'playsinline' so pausing and starting again (e.g. when scrubbing) won't go back to fullscreen.
+            // Also set the controls attribute so the user will be able to control playback.
+            setBooleanAttribute(HTMLNames::playsinlineAttr, true);
+            setControls(true);
+        }
+    }
 
 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
-        if (document().activeDOMObjectsAreSuspended() || document().activeDOMObjectsAreStopped())
-            document().page()->chrome().client().exitVideoFullscreenToModeWithoutAnimation(downcast<HTMLVideoElement>(*this), VideoFullscreenModeNone);
-        else
+    if (document().activeDOMObjectsAreSuspended() || document().activeDOMObjectsAreStopped())
+        document().page()->chrome().client().exitVideoFullscreenToModeWithoutAnimation(downcast<HTMLVideoElement>(*this), VideoFullscreenModeNone);
+    else
 #endif
-        if (document().page()->chrome().client().supportsVideoFullscreen(oldVideoFullscreenMode)) {
-            document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
-            scheduleEvent(eventNames().webkitendfullscreenEvent);
-        }
+    if (document().page()->chrome().client().supportsVideoFullscreen(oldVideoFullscreenMode)) {
+        document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
+        scheduleEvent(eventNames().webkitendfullscreenEvent);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to