Title: [240434] trunk/Source/WebCore
Revision
240434
Author
eric.carl...@apple.com
Date
2019-01-24 07:31:02 -0800 (Thu, 24 Jan 2019)

Log Message

[iOS] Enable media element volume on iPad
https://bugs.webkit.org/show_bug.cgi?id=193745
<rdar://problem/47452297>

Reviewed by Jer Noble.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setVolume):
(WebCore::HTMLMediaElement::mediaPlayerVolumeChanged):
(WebCore::HTMLMediaElement::updateVolume):

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240433 => 240434)


--- trunk/Source/WebCore/ChangeLog	2019-01-24 14:34:50 UTC (rev 240433)
+++ trunk/Source/WebCore/ChangeLog	2019-01-24 15:31:02 UTC (rev 240434)
@@ -1,3 +1,19 @@
+2019-01-24  Eric Carlson  <eric.carl...@apple.com>
+
+        [iOS] Enable media element volume on iPad
+        https://bugs.webkit.org/show_bug.cgi?id=193745
+        <rdar://problem/47452297>
+
+        Reviewed by Jer Noble.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::setVolume):
+        (WebCore::HTMLMediaElement::mediaPlayerVolumeChanged):
+        (WebCore::HTMLMediaElement::updateVolume):
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume):
+
 2019-01-24  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][WPE] Support JPEG 2000 images

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (240433 => 240434)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2019-01-24 14:34:50 UTC (rev 240433)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2019-01-24 15:31:02 UTC (rev 240434)
@@ -3712,7 +3712,11 @@
     if (!(volume >= 0 && volume <= 1))
         return Exception { IndexSizeError };
 
-#if !PLATFORM(IOS_FAMILY)
+#if PLATFORM(IOS_FAMILY)
+    if (!processingUserGestureForMedia())
+        return { };
+#endif
+
     if (m_volume == volume)
         return { };
 
@@ -3728,7 +3732,7 @@
         pauseInternal();
         setAutoplayEventPlaybackState(AutoplayEventPlaybackState::PreventedAutoplay);
     }
-#endif
+
     return { };
 }
 
@@ -4919,9 +4923,9 @@
 
     beginProcessingMediaPlayerCallback();
     if (m_player) {
-        double vol = m_player->volume();
-        if (vol != m_volume) {
-            m_volume = vol;
+        double volume = m_player->volume();
+        if (volume != m_volume) {
+            m_volume = volume;
             updateVolume();
             scheduleEvent(eventNames().volumechangeEvent);
         }
@@ -5334,14 +5338,7 @@
 {
     if (!m_player)
         return;
-#if PLATFORM(IOS_FAMILY)
-    // Only the user can change audio volume so update the cached volume and post the changed event.
-    float volume = m_player->volume();
-    if (m_volume != volume) {
-        m_volume = volume;
-        scheduleEvent(eventNames().volumechangeEvent);
-    }
-#else
+
     // Avoid recursion when the player reports volume changes.
     if (!processingMediaPlayerCallback()) {
         Page* page = document().page();
@@ -5370,7 +5367,6 @@
 
     if (hasMediaControls())
         mediaControls()->changedVolume();
-#endif
 }
 
 void HTMLMediaElement::scheduleUpdatePlayState()

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (240433 => 240434)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2019-01-24 14:34:50 UTC (rev 240433)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2019-01-24 15:31:02 UTC (rev 240434)
@@ -305,7 +305,6 @@
 #if PLATFORM(IOS_FAMILY)
 
 #if HAVE(CELESTIAL)
-
 SOFT_LINK_PRIVATE_FRAMEWORK(Celestial)
 SOFT_LINK_CONSTANT(Celestial, AVController_RouteDescriptionKey_RouteCurrentlyPicked, NSString *)
 SOFT_LINK_CONSTANT(Celestial, AVController_RouteDescriptionKey_RouteName, NSString *)
@@ -313,7 +312,6 @@
 #define AVController_RouteDescriptionKey_RouteCurrentlyPicked getAVController_RouteDescriptionKey_RouteCurrentlyPicked()
 #define AVController_RouteDescriptionKey_RouteName getAVController_RouteDescriptionKey_RouteName()
 #define AVController_RouteDescriptionKey_AVAudioRouteName getAVController_RouteDescriptionKey_AVAudioRouteName()
-
 #endif // HAVE(CELESTIAL)
 
 #endif // PLATFORM(IOS_FAMILY)
@@ -1382,14 +1380,14 @@
 void MediaPlayerPrivateAVFoundationObjC::setVolume(float volume)
 {
 #if PLATFORM(IOS_FAMILY)
-    UNUSED_PARAM(volume);
-    return;
-#else
+    if ([[PAL::getUIDeviceClass() currentDevice] userInterfaceIdiom] != UIUserInterfaceIdiomPad)
+        return;
+#endif
+
     if (!m_avPlayer)
         return;
 
     [m_avPlayer.get() setVolume:volume];
-#endif
 }
 
 void MediaPlayerPrivateAVFoundationObjC::setMuted(bool muted)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to