[MediaControls][iOS] Start playback button is visible when playing embedded YouTube
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2014 21:19:24 +0000 (21:19 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Feb 2014 21:19:24 +0000 (21:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=128754

Reviewed by Eric Carlson.

Update shouldHaveStartPlaybackButton to match the behavior of the plugin proxy.

Add a accessor to determine whether playback has been requested:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::userGestureRequired):
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:

Update the logic of shouldHaveStartPlaybackButton.
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.shouldHaveStartPlaybackButton):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164129 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
Source/WebCore/Modules/mediacontrols/MediaControlsHost.h
Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js

index 91dddf4..7ba04d7 100644 (file)
@@ -1,5 +1,24 @@
 2014-02-13  Jer Noble  <jer.noble@apple.com>
 
+        [MediaControls][iOS] Start playback button is visible when playing embedded YouTube
+        https://bugs.webkit.org/show_bug.cgi?id=128754
+
+        Reviewed by Eric Carlson.
+
+        Update shouldHaveStartPlaybackButton to match the behavior of the plugin proxy.
+
+        Add a accessor to determine whether playback has been requested:
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::userGestureRequired):
+        * Modules/mediacontrols/MediaControlsHost.h:
+        * Modules/mediacontrols/MediaControlsHost.idl:
+
+        Update the logic of shouldHaveStartPlaybackButton.
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.shouldHaveStartPlaybackButton):
+
+2014-02-13  Jer Noble  <jer.noble@apple.com>
+
         [MediaControls] Add support for a loading progress meter
         https://bugs.webkit.org/show_bug.cgi?id=128651
 
index e4173e9..a0131dd 100644 (file)
@@ -158,6 +158,11 @@ bool MediaControlsHost::supportsFullscreen()
     return m_mediaElement->supportsFullscreen();
 }
 
+bool MediaControlsHost::userGestureRequired() const
+{
+    return !m_mediaElement->mediaSession().playbackPermitted(*m_mediaElement);
+}
+
 }
 
 #endif
index 442e642..c7b7248 100644 (file)
@@ -60,6 +60,7 @@ public:
     void updateTextTrackContainer();
     bool mediaPlaybackAllowsInline() const;
     bool supportsFullscreen();
+    bool userGestureRequired() const;
 
 private:
     MediaControlsHost(HTMLMediaElement*);
index 62639c8..22e7fff 100644 (file)
@@ -38,4 +38,5 @@
     void updateTextTrackContainer();
     readonly attribute boolean mediaPlaybackAllowsInline;
     readonly attribute boolean supportsFullscreen;
+    readonly attribute boolean userGestureRequired;
 };
index 5f7a234..be2d5a4 100644 (file)
@@ -47,19 +47,24 @@ ControllerIOS.prototype = {
     },
 
     shouldHaveStartPlaybackButton: function() {
-        if (this.video.error)
-            return true;
+        var allowsInline = this.host.mediaPlaybackAllowsInline;
+
+        if (this.isAudio() && allowsInline)
+            return false;
 
         if (this.isFullScreen())
             return false;
 
-        if (!this.host.mediaPlaybackAllowsInline)
-            return true;
+        if (!this.video.currentSrc && this.video.error)
+            return false;
 
-        if (this.video.readyState <= HTMLMediaElement.HAVE_METADATA)
-            return true;
+        if (!this.video.controls && allowsInline)
+            return false;
+
+        if (!this.host.userGestureRequired && allowsInline)
+            return false;
 
-        return false;
+        return true;
     },
 
     shouldHaveControls: function() {