[iOS] MediaPlayer.framework is not always available
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Jun 2018 20:22:05 +0000 (20:22 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Jun 2018 20:22:05 +0000 (20:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186220
<rdar://problem/40571286>

Reviewed by Tim Horton.

* platform/ios/RemoteCommandListenerIOS.mm:
(WebCore::RemoteCommandListener::create):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm

index 7607a12..eccbef0 100644 (file)
@@ -1,3 +1,14 @@
+2018-06-03  Eric Carlson  <eric.carlson@apple.com>
+
+        [iOS] MediaPlayer.framework is not always available
+        https://bugs.webkit.org/show_bug.cgi?id=186220
+        <rdar://problem/40571286>
+
+        Reviewed by Tim Horton.
+
+        * platform/ios/RemoteCommandListenerIOS.mm:
+        (WebCore::RemoteCommandListener::create):
+
 2018-06-02  Darin Adler  <darin@apple.com>
 
         [Cocoa] Update some code to be more ARC-compatible to prepare for future ARC adoption
index 9a96491..35ef1cf 100644 (file)
@@ -33,7 +33,7 @@
 #import <MediaPlayer/MPRemoteCommandEvent.h>
 #import <wtf/SoftLinking.h>
 
-SOFT_LINK_FRAMEWORK(MediaPlayer)
+SOFT_LINK_FRAMEWORK_OPTIONAL(MediaPlayer)
 SOFT_LINK_CLASS(MediaPlayer, MPRemoteCommandCenter)
 SOFT_LINK_CLASS(MediaPlayer, MPSeekCommandEvent)
 SOFT_LINK_CLASS(MediaPlayer, MPChangePlaybackPositionCommandEvent)
@@ -42,6 +42,9 @@ namespace WebCore {
 
 std::unique_ptr<RemoteCommandListener> RemoteCommandListener::create(RemoteCommandListenerClient& client)
 {
+    if (!MediaPlayerLibrary())
+        return nullptr;
+
     return std::make_unique<RemoteCommandListenerIOS>(client);
 }