Title: [208802] trunk/Source/WebCore
Revision
208802
Author
[email protected]
Date
2016-11-16 12:23:46 -0800 (Wed, 16 Nov 2016)

Log Message

Implement WebPlaybackControlsManager
https://bugs.webkit.org/show_bug.cgi?id=164789
-and corresponding-
rdar://problem/29275082

Reviewed by Dan Bernstein.

* platform/mac/WebPlaybackControlsManager.h:
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager dealloc]):
(-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]):
(-[WebPlaybackControlsManager generateFunctionBarThumbnailsForTimes:size:completionHandler:]):
(-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]):
(-[WebPlaybackControlsManager canBeginFunctionBarScrubbing]):
(-[WebPlaybackControlsManager beginFunctionBarScrubbing]):
(-[WebPlaybackControlsManager endFunctionBarScrubbing]):
(-[WebPlaybackControlsManager audioFunctionBarMediaSelectionOptions]):
(-[WebPlaybackControlsManager setAudioFunctionBarMediaSelectionOptions:]):
(-[WebPlaybackControlsManager currentAudioFunctionBarMediaSelectionOption]):
(-[WebPlaybackControlsManager setCurrentAudioFunctionBarMediaSelectionOption:]):
(-[WebPlaybackControlsManager legibleFunctionBarMediaSelectionOptions]):
(-[WebPlaybackControlsManager setLegibleFunctionBarMediaSelectionOptions:]):
(-[WebPlaybackControlsManager currentLegibleFunctionBarMediaSelectionOption]):
(-[WebPlaybackControlsManager setCurrentLegibleFunctionBarMediaSelectionOption:]):
(mediaSelectionOptions):
(-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
(-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
(-[WebPlaybackControlsManager webPlaybackSessionInterfaceMac]):
(-[WebPlaybackControlsManager setWebPlaybackSessionInterfaceMac:]):
(-[WebPlaybackControlsManager togglePlayback]):
(-[WebPlaybackControlsManager setPlaying:]):
(-[WebPlaybackControlsManager isPlaying]):
* platform/mac/WebPlaybackSessionInterfaceMac.h:
* platform/mac/WebPlaybackSessionInterfaceMac.mm:
(WebCore::WebPlaybackSessionInterfaceMac::durationChanged):
(WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged):
(WebCore::WebPlaybackSessionInterfaceMac::rateChanged):
(WebCore::WebPlaybackSessionInterfaceMac::playBackControlsManager):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208801 => 208802)


--- trunk/Source/WebCore/ChangeLog	2016-11-16 20:18:45 UTC (rev 208801)
+++ trunk/Source/WebCore/ChangeLog	2016-11-16 20:23:46 UTC (rev 208802)
@@ -1,3 +1,44 @@
+2016-11-16  Beth Dakin  <[email protected]>
+
+        Implement WebPlaybackControlsManager
+        https://bugs.webkit.org/show_bug.cgi?id=164789
+        -and corresponding-
+        rdar://problem/29275082
+
+        Reviewed by Dan Bernstein.
+
+        * platform/mac/WebPlaybackControlsManager.h:
+        * platform/mac/WebPlaybackControlsManager.mm:
+        (-[WebPlaybackControlsManager dealloc]):
+        (-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]):
+        (-[WebPlaybackControlsManager generateFunctionBarThumbnailsForTimes:size:completionHandler:]):
+        (-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]):
+        (-[WebPlaybackControlsManager canBeginFunctionBarScrubbing]):
+        (-[WebPlaybackControlsManager beginFunctionBarScrubbing]):
+        (-[WebPlaybackControlsManager endFunctionBarScrubbing]):
+        (-[WebPlaybackControlsManager audioFunctionBarMediaSelectionOptions]):
+        (-[WebPlaybackControlsManager setAudioFunctionBarMediaSelectionOptions:]):
+        (-[WebPlaybackControlsManager currentAudioFunctionBarMediaSelectionOption]):
+        (-[WebPlaybackControlsManager setCurrentAudioFunctionBarMediaSelectionOption:]):
+        (-[WebPlaybackControlsManager legibleFunctionBarMediaSelectionOptions]):
+        (-[WebPlaybackControlsManager setLegibleFunctionBarMediaSelectionOptions:]):
+        (-[WebPlaybackControlsManager currentLegibleFunctionBarMediaSelectionOption]):
+        (-[WebPlaybackControlsManager setCurrentLegibleFunctionBarMediaSelectionOption:]):
+        (mediaSelectionOptions):
+        (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
+        (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
+        (-[WebPlaybackControlsManager webPlaybackSessionInterfaceMac]):
+        (-[WebPlaybackControlsManager setWebPlaybackSessionInterfaceMac:]):
+        (-[WebPlaybackControlsManager togglePlayback]):
+        (-[WebPlaybackControlsManager setPlaying:]):
+        (-[WebPlaybackControlsManager isPlaying]):
+        * platform/mac/WebPlaybackSessionInterfaceMac.h:
+        * platform/mac/WebPlaybackSessionInterfaceMac.mm:
+        (WebCore::WebPlaybackSessionInterfaceMac::durationChanged):
+        (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged):
+        (WebCore::WebPlaybackSessionInterfaceMac::rateChanged):
+        (WebCore::WebPlaybackSessionInterfaceMac::playBackControlsManager):
+
 2016-11-16  Jiewen Tan  <[email protected]>
 
         Add more tests for SubtleCrypto::importKey and SubtleCrypto::exportKey

Modified: trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.h (208801 => 208802)


--- trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.h	2016-11-16 20:18:45 UTC (rev 208801)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.h	2016-11-16 20:23:46 UTC (rev 208802)
@@ -26,6 +26,10 @@
 #ifndef WebPlaybackControlsManager_h
 #define WebPlaybackControlsManager_h
 
+#import <WebCore/AVKitSPI.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/Vector.h>
+
 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
 
 namespace WebCore {
@@ -32,28 +36,21 @@
 class WebPlaybackSessionInterfaceMac;
 }
 
-#if USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
-#import <WebKitAdditions/WebPlaybackControlsControllerAdditions.h>
-#else
-#import <WebCore/AVKitSPI.h>
-#import <wtf/RetainPtr.h>
-#import <wtf/Vector.h>
+#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 
-OBJC_CLASS AVValueTiming;
-
 WEBCORE_EXPORT
-@interface WebPlaybackControlsManager : NSObject
-#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
-    <AVFunctionBarPlaybackControlsControlling>
-#endif
-{
+@interface WebPlaybackControlsManager : NSObject <AVFunctionBarPlaybackControlsControlling> {
     NSTimeInterval _contentDuration;
-
     RetainPtr<AVValueTiming> _timing;
     NSTimeInterval _seekToTime;
     RetainPtr<NSArray> _seekableTimeRanges;
     BOOL _hasEnabledAudio;
     BOOL _hasEnabledVideo;
+    RetainPtr<NSArray<AVFunctionBarMediaSelectionOption *>> _audioFunctionBarMediaSelectionOptions;
+    RetainPtr<AVFunctionBarMediaSelectionOption> _currentAudioFunctionBarMediaSelectionOption;
+    RetainPtr<NSArray<AVFunctionBarMediaSelectionOption *>> _legibleFunctionBarMediaSelectionOptions;
+    RetainPtr<AVFunctionBarMediaSelectionOption> _currentLegibleFunctionBarMediaSelectionOption;
+
     float _rate;
     BOOL _playing;
     BOOL _canTogglePlayback;
@@ -65,19 +62,25 @@
 @property (assign) WebCore::WebPlaybackSessionInterfaceMac* webPlaybackSessionInterfaceMac;
 @property (readwrite) NSTimeInterval contentDuration;
 @property (nonatomic, retain, readwrite) AVValueTiming *timing;
+@property (nonatomic) NSTimeInterval seekToTime;
 @property (nonatomic, retain, readwrite) NSArray *seekableTimeRanges;
-@property (readwrite) BOOL hasEnabledAudio;
-@property (readwrite) BOOL hasEnabledVideo;
-@property (nonatomic) float rate;
+@property (nonatomic) BOOL hasEnabledAudio;
+@property (nonatomic) BOOL hasEnabledVideo;
 @property (getter=isPlaying) BOOL playing;
 @property BOOL canTogglePlayback;
 
+@property (nonatomic) float rate;
+
+- (AVFunctionBarMediaSelectionOption *)currentAudioFunctionBarMediaSelectionOption;
+- (void)setCurrentAudioFunctionBarMediaSelectionOption:(AVFunctionBarMediaSelectionOption *)option;
+- (AVFunctionBarMediaSelectionOption *)currentLegibleFunctionBarMediaSelectionOption;
+- (void)setCurrentLegibleFunctionBarMediaSelectionOption:(AVFunctionBarMediaSelectionOption *)option;
 - (void)setAudioMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex;
 - (void)setLegibleMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex;
-
 @end
-#endif // USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 
+#endif // ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
+
 #endif // PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
 
 #endif // WebPlaybackControlsManager_h

Modified: trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm (208801 => 208802)


--- trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm	2016-11-16 20:18:45 UTC (rev 208801)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm	2016-11-16 20:23:46 UTC (rev 208802)
@@ -26,38 +26,34 @@
 #include "config.h"
 #include "WebPlaybackControlsManager.h"
 
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 
-#if USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
-#import <WebKitAdditions/WebPlaybackControlsControllerAdditions.mm>
-#else
-
+#import "SoftLinking.h"
 #import "WebPlaybackSessionInterfaceMac.h"
+#import "WebPlaybackSessionModel.h"
+#import <wtf/text/WTFString.h>
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnullability-completeness"
+SOFT_LINK_FRAMEWORK(AVKit)
+SOFT_LINK_CLASS_OPTIONAL(AVKit, AVFunctionBarMediaSelectionOption)
+
 @implementation WebPlaybackControlsManager
 
-using namespace WebCore;
-
 @synthesize contentDuration=_contentDuration;
+@synthesize seekToTime=_seekToTime;
 @synthesize hasEnabledAudio=_hasEnabledAudio;
 @synthesize hasEnabledVideo=_hasEnabledVideo;
 @synthesize rate=_rate;
-@synthesize playing=_playing;
 @synthesize canTogglePlayback=_canTogglePlayback;
-#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
-@synthesize seekToTime=_seekToTime;
-#endif
 
-- (WebPlaybackSessionInterfaceMac*)webPlaybackSessionInterfaceMac
+- (void)dealloc
 {
-    return _webPlaybackSessionInterfaceMac.get();
+    if (_webPlaybackSessionInterfaceMac)
+        _webPlaybackSessionInterfaceMac->setPlayBackControlsManager(nullptr);
+    [super dealloc];
 }
 
-- (void)setWebPlaybackSessionInterfaceMac:(WebPlaybackSessionInterfaceMac*)webPlaybackSessionInterfaceMac
-{
-    _webPlaybackSessionInterfaceMac = webPlaybackSessionInterfaceMac;
-}
-
 - (AVValueTiming *)timing
 {
     return _timing.get();
@@ -90,20 +86,175 @@
     _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->seekToTime(time);
 }
 
+- (void)cancelThumbnailAndAudioAmplitudeSampleGeneration
+{
+}
+
+- (void)generateFunctionBarThumbnailsForTimes:(NSArray<NSNumber *> *)thumbnailTimes size:(NSSize)size completionHandler:(void (^)(NSArray<AVThumbnail *> *thumbnails, NSError *error))completionHandler
+{
+    UNUSED_PARAM(thumbnailTimes);
+    UNUSED_PARAM(size);
+    completionHandler(@[ ], nil);
+}
+
+- (void)generateFunctionBarAudioAmplitudeSamples:(NSInteger)numberOfSamples completionHandler:(void (^)(NSArray<NSNumber *> *audioAmplitudeSamples,  NSError *error))completionHandler
+{
+    UNUSED_PARAM(numberOfSamples);
+    completionHandler(@[ ], nil);
+}
+
+-(BOOL)canBeginFunctionBarScrubbing
+{
+    // It's not ideal to return YES all the time here. The intent of the API is that we return NO when the
+    // media is being scrubbed via the on-screen scrubber. But we can only possibly get the right answer for
+    // media that uses the default controls.
+    return YES;
+}
+
+- (void)beginFunctionBarScrubbing
+{
+    _webPlaybackSessionInterfaceMac->beginScrubbing();
+}
+
+- (void)endFunctionBarScrubbing
+{
+    _webPlaybackSessionInterfaceMac->endScrubbing();
+}
+
+- (NSArray<AVFunctionBarMediaSelectionOption *> *)audioFunctionBarMediaSelectionOptions
+{
+    return _audioFunctionBarMediaSelectionOptions.get();
+}
+
+- (void)setAudioFunctionBarMediaSelectionOptions:(NSArray<AVFunctionBarMediaSelectionOption *> *)audioOptions
+{
+    _audioFunctionBarMediaSelectionOptions = audioOptions;
+}
+
+- (AVFunctionBarMediaSelectionOption *)currentAudioFunctionBarMediaSelectionOption
+{
+    return _currentAudioFunctionBarMediaSelectionOption.get();
+}
+
+- (void)setCurrentAudioFunctionBarMediaSelectionOption:(AVFunctionBarMediaSelectionOption *)audioMediaSelectionOption
+{
+    if (audioMediaSelectionOption == _currentAudioFunctionBarMediaSelectionOption)
+        return;
+
+    _currentAudioFunctionBarMediaSelectionOption = audioMediaSelectionOption;
+
+    NSInteger index = NSNotFound;
+
+    if (audioMediaSelectionOption && _audioFunctionBarMediaSelectionOptions)
+        index = [_audioFunctionBarMediaSelectionOptions indexOfObject:audioMediaSelectionOption];
+
+    _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->selectAudioMediaOption(index != NSNotFound ? index : UINT64_MAX);
+}
+
+- (NSArray<AVFunctionBarMediaSelectionOption *> *)legibleFunctionBarMediaSelectionOptions
+{
+    return _legibleFunctionBarMediaSelectionOptions.get();
+}
+
+- (void)setLegibleFunctionBarMediaSelectionOptions:(NSArray<AVFunctionBarMediaSelectionOption *> *)legibleOptions
+{
+    _legibleFunctionBarMediaSelectionOptions = legibleOptions;
+}
+
+- (AVFunctionBarMediaSelectionOption *)currentLegibleFunctionBarMediaSelectionOption
+{
+    return _currentLegibleFunctionBarMediaSelectionOption.get();
+}
+
+- (void)setCurrentLegibleFunctionBarMediaSelectionOption:(AVFunctionBarMediaSelectionOption *)legibleMediaSelectionOption
+{
+    if (legibleMediaSelectionOption == _currentLegibleFunctionBarMediaSelectionOption)
+        return;
+
+    _currentLegibleFunctionBarMediaSelectionOption = legibleMediaSelectionOption;
+
+    NSInteger index = NSNotFound;
+
+    if (legibleMediaSelectionOption && _legibleFunctionBarMediaSelectionOptions)
+        index = [_legibleFunctionBarMediaSelectionOptions indexOfObject:legibleMediaSelectionOption];
+
+    _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->selectLegibleMediaOption(index != NSNotFound ? index : UINT64_MAX);
+}
+
+static RetainPtr<NSMutableArray> mediaSelectionOptions(const Vector<String>& options)
+{
+    RetainPtr<NSMutableArray> webOptions = adoptNS([[NSMutableArray alloc] initWithCapacity:options.size()]);
+    for (auto& name : options) {
+        if (RetainPtr<AVFunctionBarMediaSelectionOption> webOption = adoptNS([allocAVFunctionBarMediaSelectionOptionInstance() initWithTitle:name]))
+            [webOptions addObject:webOption.get()];
+    }
+    return webOptions;
+}
+
 - (void)setAudioMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex
 {
-    UNUSED_PARAM(options);
-    UNUSED_PARAM(selectedIndex);
+    RetainPtr<NSMutableArray> webOptions = mediaSelectionOptions(options);
+    [self setAudioFunctionBarMediaSelectionOptions:webOptions.get()];
+    if (selectedIndex < [webOptions count])
+        [self setCurrentAudioFunctionBarMediaSelectionOption:[webOptions objectAtIndex:selectedIndex]];
 }
 
 - (void)setLegibleMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex
 {
-    UNUSED_PARAM(options);
-    UNUSED_PARAM(selectedIndex);
+    RetainPtr<NSMutableArray> webOptions = mediaSelectionOptions(options);
+    [self setLegibleFunctionBarMediaSelectionOptions:webOptions.get()];
+    if (selectedIndex < [webOptions count])
+        [self setCurrentLegibleFunctionBarMediaSelectionOption:[webOptions objectAtIndex:selectedIndex]];
 }
 
+- (WebCore::WebPlaybackSessionInterfaceMac*)webPlaybackSessionInterfaceMac
+{
+    return _webPlaybackSessionInterfaceMac.get();
+}
+
+- (void)setWebPlaybackSessionInterfaceMac:(WebCore::WebPlaybackSessionInterfaceMac*)webPlaybackSessionInterfaceMac
+{
+    if (_webPlaybackSessionInterfaceMac == webPlaybackSessionInterfaceMac)
+        return;
+
+    if (_webPlaybackSessionInterfaceMac)
+        _webPlaybackSessionInterfaceMac->setPlayBackControlsManager(nullptr);
+
+    _webPlaybackSessionInterfaceMac = webPlaybackSessionInterfaceMac;
+
+    if (_webPlaybackSessionInterfaceMac)
+        _webPlaybackSessionInterfaceMac->setPlayBackControlsManager(self);
+}
+
+- (void)togglePlayback
+{
+    if (_webPlaybackSessionInterfaceMac && _webPlaybackSessionInterfaceMac->webPlaybackSessionModel())
+        _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->togglePlayState();
+}
+
+- (void)setPlaying:(BOOL)playing
+{
+    if (!_webPlaybackSessionInterfaceMac || !_webPlaybackSessionInterfaceMac->webPlaybackSessionModel())
+        return;
+
+    BOOL isCurrentlyPlaying = _playing;
+    if (!isCurrentlyPlaying && playing)
+        _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->play();
+    else if (isCurrentlyPlaying && !playing)
+        _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->pause();
+}
+
+- (BOOL)isPlaying
+{
+    if (_webPlaybackSessionInterfaceMac && _webPlaybackSessionInterfaceMac->webPlaybackSessionModel())
+        return _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->isPlaying();
+
+    return NO;
+}
+
+#pragma clang diagnostic pop
+
 @end
-#endif // USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 
-#endif // PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+#endif // PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 

Modified: trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h (208801 => 208802)


--- trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h	2016-11-16 20:18:45 UTC (rev 208801)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h	2016-11-16 20:23:46 UTC (rev 208802)
@@ -62,17 +62,22 @@
     WEBCORE_EXPORT void legibleMediaSelectionOptionsChanged(const Vector<String>& /*options*/, uint64_t /*selectedIndex*/) final;
     WEBCORE_EXPORT void invalidate();
     WEBCORE_EXPORT void ensureControlsManager();
+#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
     WEBCORE_EXPORT void setPlayBackControlsManager(WebPlaybackControlsManager *);
+    WEBCORE_EXPORT WebPlaybackControlsManager *playBackControlsManager();
+#endif
     WEBCORE_EXPORT void beginScrubbing();
     WEBCORE_EXPORT void endScrubbing();
-    WEBCORE_EXPORT WebPlaybackControlsManager *playBackControlsManager();
 
 private:
     WebPlaybackSessionInterfaceMac(WebPlaybackSessionModel&);
     WebPlaybackSessionModel* m_playbackSessionModel { nullptr };
+#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
     WebPlaybackControlsManager *m_playbackControlsManager  { nullptr };
 
     void updatePlaybackControlsManagerTiming(double currentTime, double anchorTime, double playbackRate, bool isPlaying);
+#endif
+
 };
 
 }

Modified: trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm (208801 => 208802)


--- trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm	2016-11-16 20:18:45 UTC (rev 208801)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm	2016-11-16 20:23:46 UTC (rev 208802)
@@ -64,6 +64,7 @@
 
 void WebPlaybackSessionInterfaceMac::durationChanged(double duration)
 {
+#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
     WebPlaybackControlsManager* controlsManager = playBackControlsManager();
 
     controlsManager.contentDuration = duration;
@@ -71,20 +72,25 @@
     // FIXME: We take this as an indication that playback is ready, but that is not necessarily true.
     controlsManager.hasEnabledAudio = YES;
     controlsManager.hasEnabledVideo = YES;
+#endif
 }
 
 void WebPlaybackSessionInterfaceMac::currentTimeChanged(double currentTime, double anchorTime)
 {
+#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
     WebPlaybackControlsManager* controlsManager = playBackControlsManager();
     updatePlaybackControlsManagerTiming(currentTime, anchorTime, controlsManager.rate, controlsManager.playing);
+#endif
 }
 
 void WebPlaybackSessionInterfaceMac::rateChanged(bool isPlaying, float playbackRate)
 {
+#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
     WebPlaybackControlsManager* controlsManager = playBackControlsManager();
     [controlsManager setRate:isPlaying ? playbackRate : 0.];
     [controlsManager setPlaying:isPlaying];
     updatePlaybackControlsManagerTiming(m_playbackSessionModel ? m_playbackSessionModel->currentTime() : 0, [[NSProcessInfo processInfo] systemUptime], playbackRate, isPlaying);
+#endif
 }
 
 void WebPlaybackSessionInterfaceMac::beginScrubbing()
@@ -140,13 +146,11 @@
     playBackControlsManager();
 }
 
+#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
+
 WebPlaybackControlsManager *WebPlaybackSessionInterfaceMac::playBackControlsManager()
 {
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
     return m_playbackControlsManager;
-#else
-    return nil;
-#endif
 }
 
 void WebPlaybackSessionInterfaceMac::setPlayBackControlsManager(WebPlaybackControlsManager *manager)
@@ -191,6 +195,8 @@
     manager.timing = [getAVValueTimingClass() valueTimingWithAnchorValue:currentTime anchorTimeStamp:effectiveAnchorTime rate:effectivePlaybackRate];
 }
 
+#endif // ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
+
 }
 
 #endif // PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to