Diff
Modified: trunk/Source/WebCore/ChangeLog (171287 => 171288)
--- trunk/Source/WebCore/ChangeLog 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/ChangeLog 2014-07-21 03:08:25 UTC (rev 171288)
@@ -1,3 +1,39 @@
+2014-07-20 Jeremy Jones <[email protected]>
+
+ Disable ff/rw based on canPlayFastForward and canPlayFastRewind.
+ https://bugs.webkit.org/show_bug.cgi?id=134894
+
+ Reviewed by Darin Adler.
+
+ * WebCore.exp.in: add symbol for canPlayFastReverse
+ * html/HTMLMediaElement.cpp: Add two new accessors
+ (WebCore::HTMLMediaElement::nextScanRate): possibly limit scanRate
+ (WebCore::HTMLMediaElement::canPlayFastForward): added
+ (WebCore::HTMLMediaElement::canPlayFastReverse): added
+ * html/HTMLMediaElement.h: declare two new methods
+ * platform/graphics/MediaPlayer.cpp: Plumb through two new accessors
+ (WebCore::MediaPlayer::maxFastForwardRate): added
+ (WebCore::MediaPlayer::minFastReverseRate): added
+ * platform/graphics/MediaPlayer.h: Declare new methods
+ * platform/graphics/MediaPlayerPrivate.h: Added two new methods.
+ (WebCore::MediaPlayerPrivateInterface::maxFastForwardRate): added
+ (WebCore::MediaPlayerPrivateInterface::minFastReverseRate): added
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: member to cache ff/rw enabled state
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): observe on item canPlayFastForward canPlayFastReverse
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::canPlayFastForwardDidChange): added
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::canPlayFastReverseDidChange): added
+ (WebCore::itemKVOProperties): observe canPlayFastForward canPlayFastRewind
+ (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): ditto
+ * platform/ios/WebVideoFullscreenInterface.h: add new method
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.h: ditto
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: ditto
+ (WebVideoFullscreenInterfaceAVKit::setCanPlayFastReverse): Set value on WebAVPlayerController.
+ (-[WebAVPlayerController canScanBackward]): Deleted.
+ (+[WebAVPlayerController keyPathsForValuesAffectingCanScanBackward]): Deleted.
+ * platform/ios/WebVideoFullscreenModelMediaElement.mm:
+ (WebVideoFullscreenModelMediaElement::updateForEventName): update canPlayFastReverse.
+
2014-07-18 Gavin Barraclough <[email protected]>
HTMLMediaElement should registerWithDocument on iOS
Modified: trunk/Source/WebCore/WebCore.exp.in (171287 => 171288)
--- trunk/Source/WebCore/WebCore.exp.in 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-07-21 03:08:25 UTC (rev 171288)
@@ -3445,6 +3445,7 @@
__ZN7WebCore32WebVideoFullscreenInterfaceAVKit17setSeekableRangesERKNS_10TimeRangesE
__ZN7WebCore32WebVideoFullscreenInterfaceAVKit18setVideoDimensionsEbff
__ZN7WebCore32WebVideoFullscreenInterfaceAVKit19setExternalPlaybackEbNS_27WebVideoFullscreenInterface26ExternalPlaybackTargetTypeEN3WTF6StringE
+__ZN7WebCore32WebVideoFullscreenInterfaceAVKit21setCanPlayFastReverseEb
__ZN7WebCore32WebVideoFullscreenInterfaceAVKit26setWebVideoFullscreenModelEPNS_23WebVideoFullscreenModelE
__ZN7WebCore32WebVideoFullscreenInterfaceAVKit28requestHideAndExitFullscreenEv
__ZN7WebCore32WebVideoFullscreenInterfaceAVKit29setAudioMediaSelectionOptionsERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEEy
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (171287 => 171288)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-07-21 03:08:25 UTC (rev 171288)
@@ -3103,6 +3103,9 @@
double rate = std::min(ScanMaximumRate, fabs(playbackRate() * 2));
if (m_scanDirection == Backward)
rate *= -1;
+#if PLATFORM(IOS)
+ rate = std::min(std::max(rate, minFastReverseRate()), maxFastForwardRate());
+#endif
return rate;
}
@@ -4856,6 +4859,16 @@
}
#endif
+double HTMLMediaElement::minFastReverseRate() const
+{
+ return m_player ? m_player->minFastReverseRate() : 0;
+}
+
+double HTMLMediaElement::maxFastForwardRate() const
+{
+ return m_player ? m_player->maxFastForwardRate() : 0;
+}
+
bool HTMLMediaElement::isFullscreen() const
{
if (m_isFullscreen)
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (171287 => 171288)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2014-07-21 03:08:25 UTC (rev 171288)
@@ -188,6 +188,8 @@
virtual void pause() override;
virtual void setShouldBufferData(bool) override;
void fastSeek(double);
+ double minFastReverseRate() const;
+ double maxFastForwardRate() const;
// captions
bool webkitHasClosedCaptions() const;
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (171287 => 171288)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-07-21 03:08:25 UTC (rev 171288)
@@ -893,6 +893,16 @@
}
#endif
+double MediaPlayer::maxFastForwardRate() const
+{
+ return m_private->maxFastForwardRate();
+}
+
+double MediaPlayer::minFastReverseRate() const
+{
+ return m_private->minFastReverseRate();
+}
+
#if USE(NATIVE_FULLSCREEN_VIDEO)
bool MediaPlayer::canEnterFullscreen() const
{
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (171287 => 171288)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-07-21 03:08:25 UTC (rev 171288)
@@ -480,6 +480,9 @@
void setHasPlaybackTargetAvailabilityListeners(bool);
#endif
+ double minFastReverseRate() const;
+ double maxFastForwardRate() const;
+
#if USE(NATIVE_FULLSCREEN_VIDEO)
bool canEnterFullscreen() const;
#endif
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (171287 => 171288)
--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2014-07-21 03:08:25 UTC (rev 171288)
@@ -116,6 +116,9 @@
virtual bool hasClosedCaptions() const { return false; }
virtual void setClosedCaptionsVisible(bool) { }
+ virtual double maxFastForwardRate() const { return std::numeric_limits<double>::infinity(); }
+ virtual double minFastReverseRate() const { return -std::numeric_limits<double>::infinity(); }
+
virtual MediaPlayer::NetworkState networkState() const = 0;
virtual MediaPlayer::ReadyState readyState() const = 0;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (171287 => 171288)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-07-21 03:08:25 UTC (rev 171288)
@@ -108,6 +108,8 @@
void metadataDidArrive(RetainPtr<NSArray>, double);
void firstFrameAvailableDidChange(bool);
void trackEnabledDidChange(bool);
+ void canPlayFastReverseDidChange(bool);
+ void canPlayFastForwardDidChange(bool);
virtual void setShouldBufferData(bool);
@@ -265,6 +267,9 @@
void updateDisableExternalPlayback();
#endif
+ virtual double maxFastForwardRate() const override { return m_cachedCanPlayFastForward ? std::numeric_limits<double>::infinity() : 2.0; }
+ virtual double minFastReverseRate() const override { return m_cachedCanPlayFastReverse ? -std::numeric_limits<double>::infinity() : 0.0; }
+
WeakPtrFactory<MediaPlayerPrivateAVFoundationObjC> m_weakPtrFactory;
RetainPtr<AVURLAsset> m_avAsset;
@@ -336,6 +341,8 @@
bool m_shouldBufferData;
bool m_cachedIsReadyForDisplay;
bool m_haveBeenAskedToCreateLayer;
+ bool m_cachedCanPlayFastForward;
+ bool m_cachedCanPlayFastReverse;
#if ENABLE(IOS_AIRPLAY)
mutable bool m_allowsWirelessVideoPlayback;
#endif
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (171287 => 171288)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-07-21 03:08:25 UTC (rev 171288)
@@ -2572,6 +2572,16 @@
}
#endif
+void MediaPlayerPrivateAVFoundationObjC::canPlayFastForwardDidChange(bool newValue)
+{
+ m_cachedCanPlayFastForward = newValue;
+}
+
+void MediaPlayerPrivateAVFoundationObjC::canPlayFastReverseDidChange(bool newValue)
+{
+ m_cachedCanPlayFastReverse = newValue;
+}
+
NSArray* assetMetadataKeyNames()
{
static NSArray* keys;
@@ -2605,6 +2615,8 @@
@"duration",
@"hasEnabledAudio",
@"timedMetadata",
+ @"canPlayFastForward",
+ @"canPlayFastReverse",
nil];
}
return keys;
@@ -2714,7 +2726,10 @@
if (CMTIME_IS_NUMERIC(itemTime))
now = std::max(narrowPrecisionToFloat(CMTimeGetSeconds(itemTime)), 0.0f);
function = WTF::bind(&MediaPlayerPrivateAVFoundationObjC::metadataDidArrive, m_callback, RetainPtr<NSArray>(newValue), now);
- }
+ } else if ([keyPath isEqualToString:@"canPlayFastReverse"])
+ function = WTF::bind(&MediaPlayerPrivateAVFoundationObjC::canPlayFastReverseDidChange, m_callback, [newValue boolValue]);
+ else if ([keyPath isEqualToString:@"canPlayFastForward"])
+ function = WTF::bind(&MediaPlayerPrivateAVFoundationObjC::canPlayFastForwardDidChange, m_callback, [newValue boolValue]);
}
if (context == MediaPlayerAVFoundationObservationContextPlayer && !willChange) {
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h (171287 => 171288)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h 2014-07-21 03:08:25 UTC (rev 171288)
@@ -49,6 +49,7 @@
virtual void setRate(bool isPlaying, float playbackRate) = 0;
virtual void setVideoDimensions(bool hasVideo, float width, float height) = 0;
virtual void setSeekableRanges(const TimeRanges&) = 0;
+ virtual void setCanPlayFastReverse(bool) = 0;
virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) = 0;
virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) = 0;
virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, String localizedDeviceName) = 0;
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (171287 => 171288)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2014-07-21 03:08:25 UTC (rev 171288)
@@ -83,6 +83,7 @@
virtual void setRate(bool isPlaying, float playbackRate) override;
virtual void setVideoDimensions(bool hasVideo, float width, float height) override;
virtual void setSeekableRanges(const TimeRanges&) override;
+ virtual void setCanPlayFastReverse(bool) override;
virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, String localizedDeviceName) override;
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (171287 => 171288)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2014-07-21 03:08:25 UTC (rev 171288)
@@ -91,7 +91,7 @@
@property(assign) WebVideoFullscreenModel* delegate;
@property (readonly) BOOL canScanForward;
-@property (readonly) BOOL canScanBackward;
+@property BOOL canScanBackward;
@property (readonly) BOOL canSeekToBeginning;
@property (readonly) BOOL canSeekToEnd;
@@ -301,16 +301,6 @@
self.delegate->endScanning();
}
-- (BOOL)canScanBackward
-{
- return [self canPlay];
-}
-
-+ (NSSet *)keyPathsForValuesAffectingCanScanBackward
-{
- return [NSSet setWithObject:@"canPlay"];
-}
-
- (void)beginScanningBackward:(id)sender
{
UNUSED_PARAM(sender);
@@ -678,6 +668,11 @@
});
}
+void WebVideoFullscreenInterfaceAVKit::setCanPlayFastReverse(bool canPlayFastReverse)
+{
+ playerController().canScanBackward = canPlayFastReverse;
+}
+
static NSMutableArray *mediaSelectionOptions(const Vector<String>& options)
{
NSMutableArray *webOptions = [NSMutableArray arrayWithCapacity:options.size()];
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm (171287 => 171288)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm 2014-07-21 03:08:25 UTC (rev 171288)
@@ -106,8 +106,12 @@
bool all = eventName == eventNameAll();
if (all
- || eventName == eventNames().durationchangeEvent)
+ || eventName == eventNames().durationchangeEvent) {
m_videoFullscreenInterface->setDuration(m_mediaElement->duration());
+ // These is no standard event for minFastReverseRateChange; duration change is a reasonable proxy for it.
+ // It happens every time a new item becomes ready to play.
+ m_videoFullscreenInterface->setCanPlayFastReverse(m_mediaElement->minFastReverseRate() < 0.0);
+ }
if (all
|| eventName == eventNames().pauseEvent
Modified: trunk/Source/WebKit2/ChangeLog (171287 => 171288)
--- trunk/Source/WebKit2/ChangeLog 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebKit2/ChangeLog 2014-07-21 03:08:25 UTC (rev 171288)
@@ -1,5 +1,19 @@
2014-07-20 Jeremy Jones <[email protected]>
+ Disable ff/rw based on canPlayFastForward and canPlayFastRewind.
+ https://bugs.webkit.org/show_bug.cgi?id=134894
+
+ Reviewed by Darin Adler.
+
+ Add setCanPlayFastReverse
+
+ * UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in: ditto
+ * WebProcess/ios/WebVideoFullscreenManager.h: ditto
+ * WebProcess/ios/WebVideoFullscreenManager.mm: ditto
+ (WebKit::WebVideoFullscreenManager::setCanPlayFastReverse): ditto
+
+2014-07-20 Jeremy Jones <[email protected]>
+
Decrease flicker when enter and exit fullscreen.
https://bugs.webkit.org/show_bug.cgi?id=134919
Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in (171287 => 171288)
--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in 2014-07-21 03:08:25 UTC (rev 171288)
@@ -25,6 +25,7 @@
SetCurrentTime(double currentTime, double hostTime)
SetVideoDimensions(bool hasVideo, unsigned width, unsigned height)
SetSeekableRangesVector(Vector<std::pair<double, double>> ranges);
+ SetCanPlayFastReverse(bool value);
SetAudioMediaSelectionOptions(Vector<String> options, uint64_t selectedIndex);
SetLegibleMediaSelectionOptions(Vector<String> options, uint64_t selectedIndex);
SetExternalPlaybackProperties(bool enabled, uint32_t targetType, String localizedDeviceName);
Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h (171287 => 171288)
--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h 2014-07-21 03:08:25 UTC (rev 171288)
@@ -71,6 +71,8 @@
virtual void setRate(bool isPlaying, float playbackRate) override;
virtual void setVideoDimensions(bool hasVideo, float width, float height) override;
virtual void setSeekableRanges(const WebCore::TimeRanges&) override;
+ virtual void setCanPlayFastReverse(bool value) override;
+
virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
virtual void setExternalPlayback(bool enabled, WebVideoFullscreenInterface::ExternalPlaybackTargetType, String localizedDeviceName) override;
Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (171287 => 171288)
--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm 2014-07-21 02:34:09 UTC (rev 171287)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm 2014-07-21 03:08:25 UTC (rev 171288)
@@ -146,6 +146,11 @@
m_page->send(Messages::WebVideoFullscreenManagerProxy::SetSeekableRangesVector(WTF::move(rangesVector)), m_page->pageID());
}
+void WebVideoFullscreenManager::setCanPlayFastReverse(bool value)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetCanPlayFastReverse(value), m_page->pageID());
+}
+
void WebVideoFullscreenManager::setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex)
{
m_page->send(Messages::WebVideoFullscreenManagerProxy::SetAudioMediaSelectionOptions(options, selectedIndex), m_page->pageID());