Source/WebCore:
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 May 2017 23:18:48 +0000 (23:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 May 2017 23:18:48 +0000 (23:18 +0000)
Add muted to WebPlaybackSessionModel.
https://bugs.webkit.org/show_bug.cgi?id=171592
rdar://problem/31814074

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-05-04
Reviewed by Jer Noble.

No behavior change. This just adds the ability for UI to mute.

* platform/cocoa/WebPlaybackSessionModel.h:
(WebCore::WebPlaybackSessionModelClient::mutedChanged):
* platform/cocoa/WebPlaybackSessionModelMediaElement.h:
* platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
(WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
(WebCore::WebPlaybackSessionModelMediaElement::toggleMuted):
(WebCore::WebPlaybackSessionModelMediaElement::observedEventNames):
(WebCore::WebPlaybackSessionModelMediaElement::isMuted):
* platform/ios/WebAVPlayerController.h:
* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController toggleMuted:]):
* platform/ios/WebPlaybackSessionInterfaceAVKit.h:
* platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
(WebCore::WebPlaybackSessionInterfaceAVKit::mutedChanged):
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(WebVideoFullscreenControllerContext::mutedChanged):
(WebVideoFullscreenControllerContext::isMuted):
(WebVideoFullscreenControllerContext::toggleMuted):
* platform/spi/ios/MediaPlayerSPI.h:

Source/WebKit2:
Add mute to WebPlaybackSessionModel.
https://bugs.webkit.org/show_bug.cgi?id=171592
rdar://problem/31814074

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-05-04
Reviewed by Jer Noble.

Plumb through muted.

* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
(WebKit::WebPlaybackSessionModelContext::toggleMuted):
(WebKit::WebPlaybackSessionModelContext::setMuted):
(WebKit::WebPlaybackSessionManagerProxy::setMuted):
(WebKit::WebPlaybackSessionManagerProxy::toggleMuted):
* WebProcess/cocoa/WebPlaybackSessionManager.h:
* WebProcess/cocoa/WebPlaybackSessionManager.messages.in:
* WebProcess/cocoa/WebPlaybackSessionManager.mm:
(WebKit::WebPlaybackSessionInterfaceContext::mutedChanged):
(WebKit::WebPlaybackSessionManager::mutedChanged):
(WebKit::WebPlaybackSessionManager::toggleMuted):

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

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/cocoa/WebPlaybackSessionModel.h
Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.h
Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm
Source/WebCore/platform/ios/WebAVPlayerController.h
Source/WebCore/platform/ios/WebAVPlayerController.mm
Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.h
Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.mm
Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h
Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in
Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm
Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.h
Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.messages.in
Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.mm

index 897ca5a..5d19b10 100644 (file)
@@ -1,3 +1,33 @@
+2017-05-04  Jeremy Jones  <jeremyj@apple.com>
+
+        Add muted to WebPlaybackSessionModel.
+        https://bugs.webkit.org/show_bug.cgi?id=171592
+        rdar://problem/31814074
+
+        Reviewed by Jer Noble.
+
+        No behavior change. This just adds the ability for UI to mute.
+
+        * platform/cocoa/WebPlaybackSessionModel.h:
+        (WebCore::WebPlaybackSessionModelClient::mutedChanged):
+        * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
+        * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
+        (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
+        (WebCore::WebPlaybackSessionModelMediaElement::toggleMuted):
+        (WebCore::WebPlaybackSessionModelMediaElement::observedEventNames):
+        (WebCore::WebPlaybackSessionModelMediaElement::isMuted):
+        * platform/ios/WebAVPlayerController.h:
+        * platform/ios/WebAVPlayerController.mm:
+        (-[WebAVPlayerController toggleMuted:]):
+        * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
+        * platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
+        (WebCore::WebPlaybackSessionInterfaceAVKit::mutedChanged):
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (WebVideoFullscreenControllerContext::mutedChanged):
+        (WebVideoFullscreenControllerContext::isMuted):
+        (WebVideoFullscreenControllerContext::toggleMuted):
+        * platform/spi/ios/MediaPlayerSPI.h:
+
 2017-05-04  Joseph Pecoraro  <pecoraro@apple.com>
 
         REGRESSION(r216138): Web Inspector: ASSERT(!content.isNull()) when checking for source map url opening inspector
index 7887430..68fab62 100644 (file)
@@ -56,6 +56,7 @@ public:
     virtual void selectAudioMediaOption(uint64_t index) = 0;
     virtual void selectLegibleMediaOption(uint64_t index) = 0;
     virtual void togglePictureInPicture() = 0;
+    virtual void toggleMuted() = 0;
 
     enum ExternalPlaybackTargetType { TargetTypeNone, TargetTypeAirPlay, TargetTypeTVOut };
 
@@ -76,6 +77,7 @@ public:
     virtual ExternalPlaybackTargetType externalPlaybackTargetType() const = 0;
     virtual String externalPlaybackLocalizedDeviceName() const = 0;
     virtual bool wirelessVideoPlaybackDisabled() const = 0;
+    virtual bool isMuted() const = 0;
 };
 
 class WebPlaybackSessionModelClient {
@@ -94,6 +96,7 @@ public:
     virtual void legibleMediaSelectionIndexChanged(uint64_t) { }
     virtual void externalPlaybackChanged(bool /* enabled */, WebPlaybackSessionModel::ExternalPlaybackTargetType, const String& /* localizedDeviceName */) { }
     virtual void wirelessVideoPlaybackDisabledChanged(bool) { }
+    virtual void mutedChanged(bool) { }
 };
 
 }
index 60f30ad..18d11d7 100644 (file)
@@ -70,6 +70,7 @@ public:
     WEBCORE_EXPORT void selectAudioMediaOption(uint64_t index) final;
     WEBCORE_EXPORT void selectLegibleMediaOption(uint64_t index) final;
     WEBCORE_EXPORT void togglePictureInPicture() final;
+    WEBCORE_EXPORT void toggleMuted() final;
 
     double duration() const final;
     double currentTime() const final;
@@ -87,6 +88,7 @@ public:
     ExternalPlaybackTargetType externalPlaybackTargetType() const final;
     String externalPlaybackLocalizedDeviceName() const final;
     bool wirelessVideoPlaybackDisabled() const final;
+    bool isMuted() const final;
 
 protected:
     WEBCORE_EXPORT WebPlaybackSessionModelMediaElement();
index 5f9b5c4..c6606f1 100644 (file)
@@ -165,6 +165,12 @@ void WebPlaybackSessionModelMediaElement::updateForEventName(const WTF::AtomicSt
     // updateMediaSelectionOptions() will also update the selection indices.
     if (eventName == eventNames().changeEvent)
         updateMediaSelectionIndices();
+
+    if (all
+        || eventName == eventNames().volumechangeEvent) {
+        for (auto client : m_clients)
+            client->mutedChanged(isMuted());
+    }
 }
 void WebPlaybackSessionModelMediaElement::addClient(WebPlaybackSessionModelClient& client)
 {
@@ -269,6 +275,12 @@ void WebPlaybackSessionModelMediaElement::togglePictureInPicture()
         m_mediaElement->enterFullscreen(MediaPlayerEnums::VideoFullscreenModePictureInPicture);
 }
 
+void WebPlaybackSessionModelMediaElement::toggleMuted()
+{
+    if (m_mediaElement)
+        m_mediaElement->setMuted(!m_mediaElement->muted());
+}
+
 void WebPlaybackSessionModelMediaElement::updateMediaSelectionOptions()
 {
     if (!m_mediaElement)
@@ -331,6 +343,7 @@ const Vector<AtomicString>& WebPlaybackSessionModelMediaElement::observedEventNa
         eventNames().timeupdateEvent,
         eventNames().addtrackEvent,
         eventNames().removetrackEvent,
+        eventNames().volumechangeEvent,
         eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent,
     });
     return names.get();
@@ -489,6 +502,11 @@ bool WebPlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled() const
     return m_mediaElement && m_mediaElement->mediaSession().wirelessVideoPlaybackDisabled(*m_mediaElement);
 }
 
+bool WebPlaybackSessionModelMediaElement::isMuted() const
+{
+    return m_mediaElement ? m_mediaElement->muted() : false;
+}
+
 }
 
 #endif
index ce25b58..53eda4b 100644 (file)
@@ -69,6 +69,7 @@ class WebPlaybackSessionInterfaceAVKit;
 @property AVPlayerControllerStatus status;
 @property (retain) AVValueTiming *timing;
 @property (retain) NSArray *seekableTimeRanges;
+@property (getter=isMuted) BOOL muted;
 
 @property (readonly) BOOL hasMediaSelectionOptions;
 @property (readonly) BOOL hasAudioMediaSelectionOptions;
index 92f0b4c..577f310 100644 (file)
@@ -424,6 +424,15 @@ using namespace WebCore;
             [self setPlaying:NO];
     }
 }
+
+- (void)toggleMuted:(id)sender
+{
+    UNUSED_PARAM(sender);
+    if (!self.delegate)
+        return;
+    self.delegate->toggleMuted();
+}
+
 @end
 
 @implementation WebAVMediaSelectionOption
index e15a67d..4148392 100644 (file)
@@ -82,6 +82,7 @@ public:
     WEBCORE_EXPORT void legibleMediaSelectionOptionsChanged(const Vector<MediaSelectionOption>& options, uint64_t selectedIndex) override;
     WEBCORE_EXPORT void externalPlaybackChanged(bool enabled, WebPlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) override;
     WEBCORE_EXPORT void wirelessVideoPlaybackDisabledChanged(bool) override;
+    WEBCORE_EXPORT void mutedChanged(bool) override;
 
     WEBCORE_EXPORT virtual void invalidate();
 
index 3cc4d77..57389b7 100644 (file)
@@ -218,6 +218,11 @@ void WebPlaybackSessionInterfaceAVKit::wirelessVideoPlaybackDisabledChanged(bool
     [m_playerController setAllowsExternalPlayback:!disabled];
 }
 
+void WebPlaybackSessionInterfaceAVKit::mutedChanged(bool muted)
+{
+    [m_playerController setMuted:muted];
+}
+
 void WebPlaybackSessionInterfaceAVKit::invalidate()
 {
     if (!m_playbackSessionModel)
index 499513e..f70602a 100644 (file)
@@ -166,6 +166,7 @@ private:
     String externalPlaybackLocalizedDeviceName() const override;
     bool wirelessVideoPlaybackDisabled() const override;
     void togglePictureInPicture() override { }
+    void toggleMuted() override;
 
     // WebPlaybackSessionModelClient
     void durationChanged(double) override;
@@ -178,6 +179,7 @@ private:
     void legibleMediaSelectionOptionsChanged(const Vector<MediaSelectionOption>& options, uint64_t selectedIndex) override;
     void externalPlaybackChanged(bool enabled, WebPlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) override;
     void wirelessVideoPlaybackDisabledChanged(bool) override;
+    void mutedChanged(bool) override;
 
     // WebVideoFullscreenModel
     void addClient(WebVideoFullscreenModelClient&) override;
@@ -189,6 +191,7 @@ private:
     bool isVisible() const override;
     bool hasVideo() const override;
     FloatSize videoDimensions() const override;
+    bool isMuted() const override;
 
     HashSet<WebPlaybackSessionModelClient*> m_playbackClients;
     HashSet<WebVideoFullscreenModelClient*> m_fullscreenClients;
@@ -442,6 +445,20 @@ void WebVideoFullscreenControllerContext::wirelessVideoPlaybackDisabledChanged(b
         client->wirelessVideoPlaybackDisabledChanged(disabled);
 }
 
+void WebVideoFullscreenControllerContext::mutedChanged(bool muted)
+{
+    if (WebThreadIsCurrent()) {
+        RefPtr<WebVideoFullscreenControllerContext> protectedThis(this);
+        dispatch_async(dispatch_get_main_queue(), [protectedThis, muted] {
+            protectedThis->mutedChanged(muted);
+        });
+        return;
+    }
+
+    for (auto& client : m_playbackClients)
+        client->mutedChanged(muted);
+}
+
 #pragma mark WebVideoFullscreenModel
 
 void WebVideoFullscreenControllerContext::addClient(WebVideoFullscreenModelClient& client)
@@ -521,6 +538,12 @@ bool WebVideoFullscreenControllerContext::hasVideo() const
     return m_fullscreenModel ? m_fullscreenModel->hasVideo() : false;
 }
 
+bool WebVideoFullscreenControllerContext::isMuted() const
+{
+    ASSERT(isUIThread());
+    return m_playbackModel ? m_playbackModel->isMuted() : false;
+}
+
 FloatSize WebVideoFullscreenControllerContext::videoDimensions() const
 {
     ASSERT(isUIThread());
@@ -571,6 +594,16 @@ void WebVideoFullscreenControllerContext::togglePlayState()
     });
 }
 
+void WebVideoFullscreenControllerContext::toggleMuted()
+{
+    ASSERT(isUIThread());
+    RefPtr<WebVideoFullscreenControllerContext> protectedThis(this);
+    WebThreadRun([protectedThis, this] {
+        if (m_playbackModel)
+            m_playbackModel->toggleMuted();
+    });
+}
+
 void WebVideoFullscreenControllerContext::beginScrubbing()
 {
     ASSERT(isUIThread());
index 2be998a..09b5698 100644 (file)
@@ -1,3 +1,27 @@
+2017-05-04  Jeremy Jones  <jeremyj@apple.com>
+
+        Add mute to WebPlaybackSessionModel.
+        https://bugs.webkit.org/show_bug.cgi?id=171592
+        rdar://problem/31814074
+
+        Reviewed by Jer Noble.
+
+        Plumb through muted.
+
+        * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
+        * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
+        * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
+        (WebKit::WebPlaybackSessionModelContext::toggleMuted):
+        (WebKit::WebPlaybackSessionModelContext::setMuted):
+        (WebKit::WebPlaybackSessionManagerProxy::setMuted):
+        (WebKit::WebPlaybackSessionManagerProxy::toggleMuted):
+        * WebProcess/cocoa/WebPlaybackSessionManager.h:
+        * WebProcess/cocoa/WebPlaybackSessionManager.messages.in:
+        * WebProcess/cocoa/WebPlaybackSessionManager.mm:
+        (WebKit::WebPlaybackSessionInterfaceContext::mutedChanged):
+        (WebKit::WebPlaybackSessionManager::mutedChanged):
+        (WebKit::WebPlaybackSessionManager::toggleMuted):
+
 2017-05-04  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [WK2] Image action sheets sometimes do not dismiss when beginning data interaction
index a8e9bab..9041cec 100644 (file)
@@ -83,6 +83,7 @@ public:
     void setLegibleMediaSelectionIndex(uint64_t selectedIndex);
     void setExternalPlayback(bool, WebPlaybackSessionModel::ExternalPlaybackTargetType, const String&);
     void setWirelessVideoPlaybackDisabled(bool);
+    void setMuted(bool);
 
 private:
     friend class WebVideoFullscreenModelContext;
@@ -107,6 +108,7 @@ private:
     void selectAudioMediaOption(uint64_t) final;
     void selectLegibleMediaOption(uint64_t) final;
     void togglePictureInPicture() final;
+    void toggleMuted() final;
 
     double playbackStartedTime() const final { return m_playbackStartedTime; }
     double duration() const final { return m_duration; }
@@ -125,6 +127,7 @@ private:
     WebPlaybackSessionModel::ExternalPlaybackTargetType externalPlaybackTargetType() const final { return m_externalPlaybackTargetType; }
     String externalPlaybackLocalizedDeviceName() const final { return m_externalPlaybackLocalizedDeviceName; }
     bool wirelessVideoPlaybackDisabled() const final { return m_wirelessVideoPlaybackDisabled; }
+    bool isMuted() const final { return m_muted; }
 
     WebPlaybackSessionManagerProxy* m_manager;
     uint64_t m_contextId;
@@ -147,6 +150,7 @@ private:
     WebPlaybackSessionModel::ExternalPlaybackTargetType m_externalPlaybackTargetType { WebPlaybackSessionModel::TargetTypeNone };
     String m_externalPlaybackLocalizedDeviceName;
     bool m_wirelessVideoPlaybackDisabled { false };
+    bool m_muted { false };
 };
 
 class WebPlaybackSessionManagerProxy : public RefCounted<WebPlaybackSessionManagerProxy>, private IPC::MessageReceiver {
@@ -192,6 +196,7 @@ private:
     void setPlaybackStartedTime(uint64_t contextId, double playbackStartedTime);
     void setRate(uint64_t contextId, bool isPlaying, double rate);
     void handleControlledElementIDResponse(uint64_t, String) const;
+    void setMuted(uint64_t contextId, bool muted);
 
     // Messages to WebPlaybackSessionManager
     void play(uint64_t contextId);
@@ -207,6 +212,7 @@ private:
     void selectAudioMediaOption(uint64_t contextId, uint64_t index);
     void selectLegibleMediaOption(uint64_t contextId, uint64_t index);
     void togglePictureInPicture(uint64_t contextId);
+    void toggleMuted(uint64_t contextId);
 
     WebPageProxy* m_page;
     HashMap<uint64_t, ModelInterfaceTuple> m_contextMap;
index bc2d34f..9a12987 100644 (file)
@@ -36,6 +36,7 @@ messages -> WebPlaybackSessionManagerProxy {
     SetDuration(uint64_t contextId, double duration)
     SetPlaybackStartedTime(uint64_t contextId, double playbackStartedTime)
     SetRate(uint64_t contextId, bool isPlaying, double rate)
+    SetMuted(uint64_t contextId, bool muted);
     SetUpPlaybackControlsManagerWithID(uint64_t contextId)
     ClearPlaybackControlsManager()
 
index dffdc63..90240f3 100644 (file)
@@ -135,6 +135,12 @@ void WebPlaybackSessionModelContext::togglePictureInPicture()
         m_manager->togglePictureInPicture(m_contextId);
 }
 
+void WebPlaybackSessionModelContext::toggleMuted()
+{
+    if (m_manager)
+        m_manager->toggleMuted(m_contextId);
+}
+
 void WebPlaybackSessionModelContext::setPlaybackStartedTime(double playbackStartedTime)
 {
     m_playbackStartedTime = playbackStartedTime;
@@ -238,6 +244,13 @@ void WebPlaybackSessionModelContext::setWirelessVideoPlaybackDisabled(bool wirel
         client->wirelessVideoPlaybackDisabledChanged(wirelessVideoPlaybackDisabled);
 }
 
+void WebPlaybackSessionModelContext::setMuted(bool muted)
+{
+    m_muted = muted;
+    for (auto* client : m_clients)
+        client->mutedChanged(muted);
+}
+
 #pragma mark - WebPlaybackSessionManagerProxy
 
 RefPtr<WebPlaybackSessionManagerProxy> WebPlaybackSessionManagerProxy::create(WebPageProxy& page)
@@ -414,6 +427,11 @@ void WebPlaybackSessionManagerProxy::setWirelessVideoPlaybackDisabled(uint64_t c
     ensureModel(contextId).setWirelessVideoPlaybackDisabled(disabled);
 }
 
+void WebPlaybackSessionManagerProxy::setMuted(uint64_t contextId, bool muted)
+{
+    ensureModel(contextId).setMuted(muted);
+}
+
 void WebPlaybackSessionManagerProxy::setDuration(uint64_t contextId, double duration)
 {
     ensureModel(contextId).setDuration(duration);
@@ -509,6 +527,11 @@ void WebPlaybackSessionManagerProxy::togglePictureInPicture(uint64_t contextId)
     m_page->send(Messages::WebPlaybackSessionManager::TogglePictureInPicture(contextId), m_page->pageID());
 }
 
+void WebPlaybackSessionManagerProxy::toggleMuted(uint64_t contextId)
+{
+    m_page->send(Messages::WebPlaybackSessionManager::ToggleMuted(contextId), m_page->pageID());
+}
+
 void WebPlaybackSessionManagerProxy::requestControlledElementID()
 {
     if (m_controlsManagerContextId)
index 71858e1..af3ca72 100644 (file)
@@ -87,6 +87,7 @@ private:
     void legibleMediaSelectionIndexChanged(uint64_t) final;
     void externalPlaybackChanged(bool enabled, WebCore::WebPlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) final;
     void wirelessVideoPlaybackDisabledChanged(bool) final;
+    void mutedChanged(bool) final;
 
     WebPlaybackSessionInterfaceContext(WebPlaybackSessionManager&, uint64_t contextId);
 
@@ -135,6 +136,7 @@ protected:
     void legibleMediaSelectionIndexChanged(uint64_t contextId, uint64_t selectedIndex);
     void externalPlaybackChanged(uint64_t contextId, bool enabled, WebCore::WebPlaybackSessionModel::ExternalPlaybackTargetType, String localizedDeviceName);
     void wirelessVideoPlaybackDisabledChanged(uint64_t contextId, bool);
+    void mutedChanged(uint64_t contextId, bool);
 
     // Messages from WebPlaybackSessionManagerProxy
     void play(uint64_t contextId);
@@ -151,6 +153,7 @@ protected:
     void selectLegibleMediaOption(uint64_t contextId, uint64_t index);
     void handleControlledElementIDRequest(uint64_t contextId);
     void togglePictureInPicture(uint64_t contextId);
+    void toggleMuted(uint64_t contextId);
 
     WebPage* m_page;
     HashMap<WebCore::HTMLMediaElement*, uint64_t> m_mediaElements;
index afedacb..4291eaa 100644 (file)
@@ -37,5 +37,6 @@ messages -> WebPlaybackSessionManager {
     SelectLegibleMediaOption(uint64_t contextId, uint64_t index)
     HandleControlledElementIDRequest(uint64_t contextId)
     TogglePictureInPicture(uint64_t contextId)
+    ToggleMuted(uint64_t contextId)
 }
 #endif
index c961207..28c7ee9 100644 (file)
@@ -149,6 +149,12 @@ void WebPlaybackSessionInterfaceContext::wirelessVideoPlaybackDisabledChanged(bo
         m_manager->wirelessVideoPlaybackDisabledChanged(m_contextId, disabled);
 }
 
+void WebPlaybackSessionInterfaceContext::mutedChanged(bool muted)
+{
+    if (m_manager)
+        m_manager->mutedChanged(m_contextId, muted);
+}
+
 #pragma mark - WebPlaybackSessionManager
 
 Ref<WebPlaybackSessionManager> WebPlaybackSessionManager::create(WebPage& page)
@@ -358,6 +364,11 @@ void WebPlaybackSessionManager::wirelessVideoPlaybackDisabledChanged(uint64_t co
     m_page->send(Messages::WebPlaybackSessionManagerProxy::SetWirelessVideoPlaybackDisabled(contextId, disabled));
 }
 
+void WebPlaybackSessionManager::mutedChanged(uint64_t contextId, bool muted)
+{
+    m_page->send(Messages::WebPlaybackSessionManagerProxy::SetMuted(contextId, muted));
+}
+
 #pragma mark Messages from WebPlaybackSessionManagerProxy:
 
 void WebPlaybackSessionManager::play(uint64_t contextId)
@@ -445,6 +456,12 @@ void WebPlaybackSessionManager::togglePictureInPicture(uint64_t contextId)
     ensureModel(contextId).togglePictureInPicture();
 }
 
+void WebPlaybackSessionManager::toggleMuted(uint64_t contextId)
+{
+    UserGestureIndicator indicator(ProcessingUserGesture);
+    ensureModel(contextId).toggleMuted();
+}
+
 } // namespace WebKit
 
 #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))