[Mac] Playback target isn't set on new element
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 May 2015 14:12:17 +0000 (14:12 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 May 2015 14:12:17 +0000 (14:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144724

Reviewed by Jer Noble.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Call setShouldPlayToPlaybackTarget
if necessary.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): Remember
the setting in case we don't have an AVPlayer yet.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

index 91215f2..18ced8b 100644 (file)
@@ -1,3 +1,17 @@
+2015-05-07  Eric Carlson  <eric.carlson@apple.com>
+
+        [Mac] Playback target isn't set on new element
+        https://bugs.webkit.org/show_bug.cgi?id=144724
+
+        Reviewed by Jer Noble.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Call setShouldPlayToPlaybackTarget
+        if necessary.
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): Remember
+        the setting in case we don't have an AVPlayer yet.
+
 2015-05-07  Yoav Weiss  <yoav@yoav.ws>
 
         Fix <script srcset> being loaded by the preloader.
index 78468d1..c79f88d 100644 (file)
@@ -379,6 +379,7 @@ private:
     bool m_cachedCanPlayFastReverse;
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     mutable bool m_allowsWirelessVideoPlayback;
+    bool m_shouldPlayToPlaybackTarget { false };
 #endif
 };
 
index 41b6150..1c4e01e 100644 (file)
@@ -946,6 +946,11 @@ void MediaPlayerPrivateAVFoundationObjC::createAVPlayer()
     [m_avPlayer.get() setAllowsExternalPlayback:m_allowsWirelessVideoPlayback];
 #endif
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+    if (m_shouldPlayToPlaybackTarget)
+        setShouldPlayToPlaybackTarget(true);
+#endif
+
     if (player()->client().mediaPlayerIsVideo())
         createAVPlayerLayer();
 
@@ -2781,6 +2786,8 @@ void MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget(Ref<MediaPlay
 
 void MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget(bool shouldPlay)
 {
+    m_shouldPlayToPlaybackTarget = shouldPlay;
+
     if (!m_avPlayer)
         return;