[Mac] inform media session of all state changes
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 21:53:07 +0000 (21:53 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 21:53:07 +0000 (21:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145222

Reviewed by Dean Jackson.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::~HTMLMediaElement): Call updateMediaState.
(WebCore::HTMLMediaElement::mediaPlayerEngineUpdated): Ditto.
(WebCore::HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable): Ditto.
(WebCore::HTMLMediaElement::removeEventListener): Ditto.
(WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent): Ditto.

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

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp

index 81c2eb4..1868577 100644 (file)
@@ -1,3 +1,17 @@
+2015-05-20  Eric Carlson  <eric.carlson@apple.com>
+
+        [Mac] inform media session of all state changes
+        https://bugs.webkit.org/show_bug.cgi?id=145222
+
+        Reviewed by Dean Jackson.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::~HTMLMediaElement): Call updateMediaState.
+        (WebCore::HTMLMediaElement::mediaPlayerEngineUpdated): Ditto.
+        (WebCore::HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable): Ditto.
+        (WebCore::HTMLMediaElement::removeEventListener): Ditto.
+        (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent): Ditto.
+
 2015-05-20  Daniel Bates  <dabates@apple.com>
 
         AX: AutoFill button is not accessible with VoiceOver
index 0ff86aa..8f604d6 100644 (file)
@@ -412,6 +412,7 @@ HTMLMediaElement::~HTMLMediaElement()
     if (hasEventListeners(eventNames().webkitplaybacktargetavailabilitychangedEvent)) {
         m_hasPlaybackTargetAvailabilityListeners = false;
         m_mediaSession->setHasPlaybackTargetAvailabilityListeners(*this, false);
+        updateMediaState();
     }
 #endif
 
@@ -4350,6 +4351,9 @@ void HTMLMediaElement::mediaPlayerEngineUpdated(MediaPlayer*)
     m_player->setVideoFullscreenGravity(m_videoFullscreenGravity);
     m_player->setVideoFullscreenLayer(m_videoFullscreenLayer.get());
 #endif
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    updateMediaState();
+#endif
 }
 
 void HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable(MediaPlayer*)
@@ -4953,6 +4957,7 @@ bool HTMLMediaElement::removeEventListener(const AtomicString& eventType, EventL
     if (didRemoveLastAvailabilityChangedListener) {
         m_hasPlaybackTargetAvailabilityListeners = false;
         m_mediaSession->setHasPlaybackTargetAvailabilityListeners(*this, false);
+        updateMediaState();
     }
 
     return true;
@@ -4965,6 +4970,7 @@ void HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent()
     RefPtr<Event> event = WebKitPlaybackTargetAvailabilityEvent::create(eventNames().webkitplaybacktargetavailabilitychangedEvent, hasTargets);
     event->setTarget(this);
     m_asyncEventQueue.enqueueEvent(event.release());
+    updateMediaState();
 }
 
 void HTMLMediaElement::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& device)