Diff
Modified: trunk/Source/WebCore/ChangeLog (165124 => 165125)
--- trunk/Source/WebCore/ChangeLog 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/ChangeLog 2014-03-05 21:37:38 UTC (rev 165125)
@@ -1,3 +1,38 @@
+2014-03-05 Eric Carlson <[email protected]>
+
+ [iOS] Show external device name/type in placeholder
+ https://bugs.webkit.org/show_bug.cgi?id=129723
+
+ Reviewed by Jer Noble.
+
+ Make the name and type of the external device available to the JS based controls.
+ * Modules/mediacontrols/MediaControlsHost.cpp:
+ (WebCore::MediaControlsHost::externalDeviceDisplayName):
+ (WebCore::MediaControlsHost::externalDeviceType):
+ * Modules/mediacontrols/MediaControlsHost.h:
+ * Modules/mediacontrols/MediaControlsHost.idl:
+
+ * Modules/mediacontrols/mediaControlsiOS.js:
+ (ControllerIOS.prototype.updateWirelessPlaybackStatus): Display device type-specific infomation
+ in the placeholder image.
+
+ * WebCore.exp.in: Export new WebKitSystemInterface functions.
+
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::wirelessPlaybackTargetName): Added.
+ (WebCore::MediaPlayer::wirelessPlaybackTargetType): Ditto.
+ * platform/graphics/MediaPlayer.h:
+ * platform/graphics/MediaPlayerPrivate.h:
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetType): Added.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName): Ditto.
+
+ * platform/ios/WebCoreSystemInterfaceIOS.mm:
+ * platform/mac/WebCoreSystemInterface.h:
+ * platform/mac/WebCoreSystemInterface.mm:
+
2014-03-05 Benjamin Poulain <[email protected]>
[iOS] Rename the various VisibleExtent variations to exposedContentRect
Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp (165124 => 165125)
--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp 2014-03-05 21:37:38 UTC (rev 165125)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,6 +32,7 @@
#include "CaptionUserPreferences.h"
#include "Element.h"
#include "HTMLMediaElement.h"
+#include "Logging.h"
#include "MediaControlElements.h"
#include "Page.h"
#include "PageGroup.h"
@@ -163,6 +164,57 @@
return !m_mediaElement->mediaSession().playbackPermitted(*m_mediaElement);
}
+String MediaControlsHost::externalDeviceDisplayName() const
+{
+#if ENABLE(IOS_AIRPLAY)
+ MediaPlayer* player = m_mediaElement->player();
+ if (!player) {
+ LOG(Media, "MediaControlsHost::externalDeviceDisplayName - returning \"\" because player is NULL");
+ return emptyString();
+ }
+
+ String name = player->wirelessPlaybackTargetName();
+ LOG(Media, "MediaControlsHost::externalDeviceDisplayName - returning \"%s\"", name.utf8().data());
+
+ return name;
+#else
+ return emptyString();
+#endif
}
+String MediaControlsHost::externalDeviceType() const
+{
+ DEFINE_STATIC_LOCAL(String, none, (ASCIILiteral("none")));
+ String type = none;
+
+#if ENABLE(IOS_AIRPLAY)
+ DEFINE_STATIC_LOCAL(String, airplay, (ASCIILiteral("airplay")));
+ DEFINE_STATIC_LOCAL(String, tvout, (ASCIILiteral("tvout")));
+
+ MediaPlayer* player = m_mediaElement->player();
+ if (!player) {
+ LOG(Media, "MediaControlsHost::externalDeviceType - returning \"none\" because player is NULL");
+ return none;
+ }
+
+ switch (player->wirelessPlaybackTargetType()) {
+ case MediaPlayer::TargetTypeNone:
+ type = none;
+ break;
+ case MediaPlayer::TargetTypeAirPlay:
+ type = airplay;
+ break;
+ case MediaPlayer::TargetTypeTVOut:
+ type = tvout;
+ break;
+ }
#endif
+
+ LOG(Media, "MediaControlsHost::externalDeviceType - returning \"%s\"", type.utf8().data());
+
+ return type;
+}
+
+}
+
+#endif
Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h (165124 => 165125)
--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h 2014-03-05 21:37:38 UTC (rev 165125)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -62,6 +62,9 @@
bool supportsFullscreen();
bool userGestureRequired() const;
+ String externalDeviceDisplayName() const;
+ String externalDeviceType() const;
+
private:
MediaControlsHost(HTMLMediaElement*);
Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl (165124 => 165125)
--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl 2014-03-05 21:37:38 UTC (rev 165125)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,6 +23,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+enum DeviceType {
+ "none",
+ "airplay",
+ "tvout"
+};
+
[
NoInterfaceObject,
Conditional=MEDIA_CONTROLS_SCRIPT,
@@ -39,4 +45,7 @@
readonly attribute boolean mediaPlaybackAllowsInline;
readonly attribute boolean supportsFullscreen;
readonly attribute boolean userGestureRequired;
+
+ readonly attribute DOMString externalDeviceDisplayName;
+ readonly attribute DeviceType externalDeviceType;
};
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (165124 => 165125)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js 2014-03-05 21:37:38 UTC (rev 165125)
@@ -68,8 +68,11 @@
},
localizedStrings: {
// FIXME: Move localization to ext strings file <http://webkit.org/b/120956>
- '##DEVICE_TYPE##': 'AirPlay',
- '##DEVICE_NAME##': 'This video is playing on "##DEVICE_NAME##".',
+ '##AIRPLAY_DEVICE_TYPE##': 'AirPlay',
+ '##AIRPLAY_DEVICE_NAME##': 'This video is playing on "##DEVICE_NAME##".',
+
+ '##TVOUT_DEVICE_TYPE##': 'TV Connected',
+ '##TVOUT_DEVICE_NAME##': 'This video is playing on the TV.',
},
shouldHaveStartPlaybackButton: function() {
@@ -112,12 +115,18 @@
if (this.currentPlaybackTargetIsWireless()) {
var backgroundImageSVG = "url('" + ControllerIOS.gWirelessImage + "')";
- var deviceType = this.UIString('##DEVICE_TYPE##');
+ var deviceName = "";
+ var deviceType = "";
+ var type = this.host.externalDeviceType;
+ if (type == "airplay") {
+ deviceType = this.UIString('##AIRPLAY_DEVICE_TYPE##');
+ deviceName = this.UIString('##AIRPLAY_DEVICE_NAME##').replace('##DEVICE_NAME##', this.host.externalDeviceDisplayName);
+ } else if (type == "tvout") {
+ deviceType = this.UIString('##TVOUT_DEVICE_TYPE##');
+ deviceName = this.UIString('##TVOUT_DEVICE_NAME##');
+ }
+
backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_TYPE##', deviceType);
-
- // FIXME: Get the device type and name from the host.
- var deviceName = "unknown";
- var deviceName = this.UIString('##DEVICE_NAME##').replace('##DEVICE_NAME##', deviceName);;
backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_NAME##', deviceName);
this.controls.wirelessPlaybackStatus.style.backgroundImage = backgroundImageSVG;
Modified: trunk/Source/WebCore/WebCore.exp.in (165124 => 165125)
--- trunk/Source/WebCore/WebCore.exp.in 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-03-05 21:37:38 UTC (rev 165125)
@@ -1970,6 +1970,8 @@
_wkDeleteAllHTTPCookies
_wkDeleteHTTPCookie
_wkDestroyRenderingResources
+_wkExernalDeviceDisplayNameForPlayer
+_wkExernalDeviceTypeForPlayer
_wkGetCFURLResponseHTTPResponse
_wkGetCFURLResponseMIMEType
_wkGetCFURLResponseURL
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (165124 => 165125)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-03-05 21:37:38 UTC (rev 165125)
@@ -851,6 +851,16 @@
return m_private->isCurrentPlaybackTargetWireless();
}
+String MediaPlayer::wirelessPlaybackTargetName() const
+{
+ return m_private->wirelessPlaybackTargetName();
+}
+
+MediaPlayer::WirelessPlaybackTargetType MediaPlayer::wirelessPlaybackTargetType() const
+{
+ return m_private->wirelessPlaybackTargetType();
+}
+
void MediaPlayer::showPlaybackTargetPicker()
{
m_private->showPlaybackTargetPicker();
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (165124 => 165125)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-03-05 21:37:38 UTC (rev 165125)
@@ -449,6 +449,12 @@
#if ENABLE(IOS_AIRPLAY)
bool isCurrentPlaybackTargetWireless() const;
+
+ enum WirelessPlaybackTargetType { TargetTypeNone, TargetTypeAirPlay, TargetTypeTVOut };
+ WirelessPlaybackTargetType wirelessPlaybackTargetType() const;
+
+ String wirelessPlaybackTargetName() const;
+
void showPlaybackTargetPicker();
bool hasWirelessPlaybackTargets() const;
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (165124 => 165125)
--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2014-03-05 21:37:38 UTC (rev 165125)
@@ -145,6 +145,10 @@
#if ENABLE(IOS_AIRPLAY)
virtual bool isCurrentPlaybackTargetWireless() const { return false; }
+
+ virtual String wirelessPlaybackTargetName() const { return emptyString(); }
+ virtual MediaPlayer::WirelessPlaybackTargetType wirelessPlaybackTargetType() const { return MediaPlayer::TargetTypeNone; }
+
virtual void showPlaybackTargetPicker() { }
virtual bool hasWirelessPlaybackTargets() const { return false; }
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (165124 => 165125)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-03-05 21:37:38 UTC (rev 165125)
@@ -228,6 +228,8 @@
#if ENABLE(IOS_AIRPLAY)
virtual bool isCurrentPlaybackTargetWireless() const override;
+ virtual String wirelessPlaybackTargetName() const override;
+ virtual MediaPlayer::WirelessPlaybackTargetType wirelessPlaybackTargetType() const override;
virtual bool wirelessVideoPlaybackDisabled() const override;
virtual void setWirelessVideoPlaybackDisabled(bool) override;
#endif
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (165124 => 165125)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-03-05 21:37:38 UTC (rev 165125)
@@ -87,7 +87,6 @@
@end
#endif
-
SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
SOFT_LINK_FRAMEWORK_OPTIONAL(CoreMedia)
SOFT_LINK_FRAMEWORK_OPTIONAL(CoreImage)
@@ -1917,6 +1916,35 @@
return wirelessTarget;
}
+MediaPlayer::WirelessPlaybackTargetType MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetType() const
+{
+ if (!m_avPlayer)
+ return MediaPlayer::TargetTypeNone;
+
+ switch (wkExernalDeviceTypeForPlayer(m_avPlayer.get())) {
+ case wkExternalPlaybackTypeNone:
+ return MediaPlayer::TargetTypeNone;
+ case wkExternalPlaybackTypeAirPlay:
+ return MediaPlayer::TargetTypeAirPlay;
+ case wkExternalPlaybackTypeTVOut:
+ return MediaPlayer::TargetTypeTVOut;
+ }
+
+ ASSERT_NOT_REACHED();
+ return MediaPlayer::TargetTypeNone;
+}
+
+String MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName() const
+{
+ if (!m_avPlayer)
+ return emptyString();
+
+ String wirelessTargetName = wkExernalDeviceDisplayNameForPlayer(m_avPlayer.get());
+ LOG(Media, "MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName(%p) - returning %s", this, wirelessTargetName.utf8().data());
+
+ return wirelessTargetName;
+}
+
bool MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled() const
{
if (!m_avPlayer)
Modified: trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm (165124 => 165125)
--- trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm 2014-03-05 21:37:38 UTC (rev 165125)
@@ -147,3 +147,6 @@
CFStringRef (*wkGetOSNameForUserAgent)(void);
CFStringRef (*wkGetPlatformNameForNavigator)(void);
CFStringRef (*wkGetVendorNameForNavigator)(void);
+
+int (*wkExernalDeviceTypeForPlayer)(AVPlayer *);
+NSString *(*wkExernalDeviceDisplayNameForPlayer)(AVPlayer *);
Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (165124 => 165125)
--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2014-03-05 21:37:38 UTC (rev 165125)
@@ -94,6 +94,7 @@
#endif
OBJC_CLASS AVAsset;
+OBJC_CLASS AVPlayer;
OBJC_CLASS CALayer;
OBJC_CLASS NSArray;
OBJC_CLASS NSButtonCell;
@@ -369,6 +370,15 @@
#if ENABLE(CACHE_PARTITIONING)
extern CFStringRef (*wkCachePartitionKey)(void);
#endif
+
+typedef enum {
+ wkExternalPlaybackTypeNone,
+ wkExternalPlaybackTypeAirPlay,
+ wkExternalPlaybackTypeTVOut,
+} wkExternalPlaybackType;
+extern int (*wkExernalDeviceTypeForPlayer)(AVPlayer *);
+extern NSString *(*wkExernalDeviceDisplayNameForPlayer)(AVPlayer *);
+
}
#endif
Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (165124 => 165125)
--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2014-03-05 21:37:38 UTC (rev 165125)
@@ -212,3 +212,6 @@
#if ENABLE(CACHE_PARTITIONING)
CFStringRef (*wkCachePartitionKey)(void);
#endif
+
+int (*wkExernalDeviceTypeForPlayer)(AVPlayer *);
+NSString *(*wkExernalDeviceDisplayNameForPlayer)(AVPlayer *);
Modified: trunk/Source/WebKit/mac/ChangeLog (165124 => 165125)
--- trunk/Source/WebKit/mac/ChangeLog 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-03-05 21:37:38 UTC (rev 165125)
@@ -1,3 +1,13 @@
+2014-03-05 Eric Carlson <[email protected]>
+
+ [iOS] Show external device name/type in placeholder
+ https://bugs.webkit.org/show_bug.cgi?id=129723
+
+ Reviewed by Jer Noble.
+
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
2014-03-05 Simon Fraser <[email protected]>
ObjC exception when dropping files into a WKView: drag and drop uses code from WebKit.framework
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (165124 => 165125)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm 2014-03-05 21:37:38 UTC (rev 165125)
@@ -244,5 +244,8 @@
INIT(CachePartitionKey);
#endif
+ INIT(ExernalDeviceTypeForPlayer);
+ INIT(ExernalDeviceDisplayNameForPlayer);
+
didInit = true;
}
Modified: trunk/WebKitLibraries/ChangeLog (165124 => 165125)
--- trunk/WebKitLibraries/ChangeLog 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/WebKitLibraries/ChangeLog 2014-03-05 21:37:38 UTC (rev 165125)
@@ -1,3 +1,15 @@
+2014-03-05 Eric Carlson <[email protected]>
+
+ [iOS] Show external device name/type in placeholder
+ https://bugs.webkit.org/show_bug.cgi?id=129723
+
+ Reviewed by Jer Noble.
+
+ * WebKitSystemInterface.h:
+ * libWebKitSystemInterfaceLion.a:
+ * libWebKitSystemInterfaceMavericks.a:
+ * libWebKitSystemInterfaceMountainLion.a:
+
2014-02-21 Jeffrey Pfau <[email protected]>
[Mac] Cache callbacks for cache partitioning may be passed null
Modified: trunk/WebKitLibraries/WebKitSystemInterface.h (165124 => 165125)
--- trunk/WebKitLibraries/WebKitSystemInterface.h 2014-03-05 21:30:08 UTC (rev 165124)
+++ trunk/WebKitLibraries/WebKitSystemInterface.h 2014-03-05 21:37:38 UTC (rev 165125)
@@ -21,6 +21,7 @@
#endif
@class AVAsset;
+@class AVPlayer;
@class QTMovie;
@class QTMovieView;
@@ -548,6 +549,15 @@
void WKCFURLCacheCopyAllPartitionNames(CFURLCacheCopyAllPartitionNamesResultsNotification resultsBlock);
#endif
+typedef enum {
+ WKExternalPlaybackTypeNone,
+ WKExternalPlaybackTypeAirPlay,
+ WKExternalPlaybackTypeTVOut,
+} WKExternalPlaybackType;
+
+int WKExernalDeviceTypeForPlayer(AVPlayer *);
+NSString *WKExernalDeviceDisplayNameForPlayer(AVPlayer *);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/WebKitLibraries/libWebKitSystemInterfaceLion.a
(Binary files differ)
Modified: trunk/WebKitLibraries/libWebKitSystemInterfaceMavericks.a
(Binary files differ)
Modified: trunk/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a
(Binary files differ)