Changeset 224085 in webkit


Ignore:
Timestamp:
Oct 26, 2017 11:06:38 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Implement seek tolerance methods in WebAVPlayerController.
https://bugs.webkit.org/show_bug.cgi?id=178838
rdar://problem/33781777

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-10-26
Reviewed by Eric Carlson.

Source/WebCore:

No new tests because this doesn't change any behavior in the page, but exposes seek tolerance to fullscreen platform UI.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::setCurrentTimeWithTolerance):

  • html/HTMLMediaElement.h:
  • platform/cocoa/PlaybackSessionModel.h:
  • platform/cocoa/PlaybackSessionModelMediaElement.h:
  • platform/cocoa/PlaybackSessionModelMediaElement.mm:

(WebCore::PlaybackSessionModelMediaElement::seekToTime):

  • platform/ios/WebAVPlayerController.mm:

(-[WebAVPlayerController seekToTime:]):
(-[WebAVPlayerController seekToTime:toleranceBefore:toleranceAfter:]):
(-[WebAVPlayerController seekByTimeInterval:]):
(-[WebAVPlayerController seekByTimeInterval:toleranceBefore:toleranceAfter:]):
(-[WebAVPlayerController seekToBeginning:]):
(-[WebAVPlayerController seekToEnd:]):

  • platform/ios/WebVideoFullscreenControllerAVKit.mm:

(VideoFullscreenControllerContext::seekToTime):

Source/WebKit:

This implementes additional methods on WebAVPlayerController that allows AVKit more control over seeking.

  • UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
  • UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:

(WebKit::PlaybackSessionModelContext::seekToTime):
(WebKit::PlaybackSessionManagerProxy::seekToTime):

  • WebProcess/cocoa/PlaybackSessionManager.h:
  • WebProcess/cocoa/PlaybackSessionManager.messages.in:
  • WebProcess/cocoa/PlaybackSessionManager.mm:

(WebKit::PlaybackSessionManager::seekToTime):

Location:
trunk/Source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r224079 r224085  
     12017-10-26  Jeremy Jones  <jeremyj@apple.com>
     2
     3        Implement seek tolerance methods in WebAVPlayerController.
     4        https://bugs.webkit.org/show_bug.cgi?id=178838
     5        rdar://problem/33781777
     6
     7        Reviewed by Eric Carlson.
     8
     9        No new tests because this doesn't change any behavior in the page, but exposes seek tolerance to fullscreen platform UI.
     10
     11        * html/HTMLMediaElement.cpp:
     12        (WebCore::HTMLMediaElement::setCurrentTimeWithTolerance):
     13        * html/HTMLMediaElement.h:
     14        * platform/cocoa/PlaybackSessionModel.h:
     15        * platform/cocoa/PlaybackSessionModelMediaElement.h:
     16        * platform/cocoa/PlaybackSessionModelMediaElement.mm:
     17        (WebCore::PlaybackSessionModelMediaElement::seekToTime):
     18        * platform/ios/WebAVPlayerController.mm:
     19        (-[WebAVPlayerController seekToTime:]):
     20        (-[WebAVPlayerController seekToTime:toleranceBefore:toleranceAfter:]):
     21        (-[WebAVPlayerController seekByTimeInterval:]):
     22        (-[WebAVPlayerController seekByTimeInterval:toleranceBefore:toleranceAfter:]):
     23        (-[WebAVPlayerController seekToBeginning:]):
     24        (-[WebAVPlayerController seekToEnd:]):
     25        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
     26        (VideoFullscreenControllerContext::seekToTime):
     27
    1282017-10-26  Michael Catanzaro  <mcatanzaro@igalia.com>
    229
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r223960 r224085  
    31433143}
    31443144
     3145void HTMLMediaElement::setCurrentTimeWithTolerance(double time, double toleranceBefore, double toleranceAfter)
     3146{
     3147    seekWithTolerance(MediaTime::createWithDouble(time), MediaTime::createWithDouble(toleranceBefore), MediaTime::createWithDouble(toleranceAfter), true);
     3148}
     3149
    31453150void HTMLMediaElement::setCurrentTime(const MediaTime& time)
    31463151{
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r224030 r224085  
    227227    WEBCORE_EXPORT double currentTime() const override;
    228228    void setCurrentTime(double) override;
     229    void setCurrentTimeWithTolerance(double, double toleranceBefore, double toleranceAfter);
    229230    double currentTimeForBindings() const { return currentTime(); }
    230231    WEBCORE_EXPORT ExceptionOr<void> setCurrentTimeForBindings(double);
  • trunk/Source/WebCore/platform/cocoa/PlaybackSessionModel.h

    r219996 r224085  
    4949    virtual void beginScrubbing() = 0;
    5050    virtual void endScrubbing() = 0;
    51     virtual void seekToTime(double time) = 0;
     51    virtual void seekToTime(double time, double toleranceBefore = 0, double toleranceAfter = 0) = 0;
    5252    virtual void fastSeek(double time) = 0;
    5353    virtual void beginScanningForward() = 0;
  • trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h

    r219996 r224085  
    6363    WEBCORE_EXPORT void beginScrubbing() final;
    6464    WEBCORE_EXPORT void endScrubbing() final;
    65     WEBCORE_EXPORT void seekToTime(double time) final;
     65    WEBCORE_EXPORT void seekToTime(double time, double toleranceBefore, double toleranceAfter) final;
    6666    WEBCORE_EXPORT void fastSeek(double time) final;
    6767    WEBCORE_EXPORT void beginScanningForward() final;
  • trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm

    r219996 r224085  
    219219}
    220220
    221 void PlaybackSessionModelMediaElement::seekToTime(double time)
    222 {
    223     if (m_mediaElement)
    224         m_mediaElement->setCurrentTime(time);
     221void PlaybackSessionModelMediaElement::seekToTime(double time, double toleranceBefore, double toleranceAfter)
     222{
     223    if (m_mediaElement)
     224        m_mediaElement->setCurrentTimeWithTolerance(time, toleranceBefore, toleranceAfter);
    225225}
    226226
  • trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm

    r223476 r224085  
    168168{
    169169    if (self.delegate)
    170         self.delegate->fastSeek(time);
     170        self.delegate->seekToTime(time);
     171}
     172
     173- (void)seekToTime:(NSTimeInterval)time toleranceBefore:(NSTimeInterval)before toleranceAfter:(NSTimeInterval)after
     174{
     175    self.delegate->seekToTime(time, before, after);
     176}
     177
     178- (void)seekByTimeInterval:(NSTimeInterval)interval
     179{
     180    [self seekByTimeInterval:interval toleranceBefore:0. toleranceAfter:0.];
     181}
     182
     183- (void)seekByTimeInterval:(NSTimeInterval)interval toleranceBefore:(NSTimeInterval)before toleranceAfter:(NSTimeInterval)after
     184{
     185    NSTimeInterval targetTime = [[self timing] currentValue] + interval;
     186    [self seekToTime:targetTime toleranceBefore:before toleranceAfter:after];
    171187}
    172188
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm

    r220506 r224085  
    141141    void beginScrubbing() override;
    142142    void endScrubbing() override;
    143     void seekToTime(double) override;
     143    void seekToTime(double, double, double) override;
    144144    void fastSeek(double time) override;
    145145    void beginScanningForward() override;
     
    636636}
    637637
    638 void VideoFullscreenControllerContext::seekToTime(double time)
    639 {
    640     ASSERT(isUIThread());
    641     RefPtr<VideoFullscreenControllerContext> protectedThis(this);
    642     WebThreadRun([protectedThis, this, time] {
    643         if (m_playbackModel)
    644             m_playbackModel->seekToTime(time);
     638void VideoFullscreenControllerContext::seekToTime(double time, double toleranceBefore, double toleranceAfter)
     639{
     640    ASSERT(isUIThread());
     641    RefPtr<VideoFullscreenControllerContext> protectedThis(this);
     642    WebThreadRun([protectedThis, this, time, toleranceBefore, toleranceAfter] {
     643        if (m_playbackModel)
     644            m_playbackModel->seekToTime(time, toleranceBefore, toleranceAfter);
    645645    });
    646646}
  • trunk/Source/WebKit/ChangeLog

    r224082 r224085  
     12017-10-26  Jeremy Jones  <jeremyj@apple.com>
     2
     3        Implement seek tolerance methods in WebAVPlayerController.
     4        https://bugs.webkit.org/show_bug.cgi?id=178838
     5        rdar://problem/33781777
     6
     7        Reviewed by Eric Carlson.
     8
     9        This implementes additional methods on WebAVPlayerController that allows AVKit more control over seeking.
     10
     11        * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
     12        * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
     13        (WebKit::PlaybackSessionModelContext::seekToTime):
     14        (WebKit::PlaybackSessionManagerProxy::seekToTime):
     15        * WebProcess/cocoa/PlaybackSessionManager.h:
     16        * WebProcess/cocoa/PlaybackSessionManager.messages.in:
     17        * WebProcess/cocoa/PlaybackSessionManager.mm:
     18        (WebKit::PlaybackSessionManager::seekToTime):
     19
    1202017-10-26  Brian Burg  <bburg@apple.com>
    221
  • trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h

    r219996 r224085  
    101101    void beginScrubbing() final;
    102102    void endScrubbing() final;
    103     void seekToTime(double) final;
     103    void seekToTime(double, double, double) final;
    104104    void fastSeek(double time) final;
    105105    void beginScanningForward() final;
     
    210210    void beginScrubbing(uint64_t contextId);
    211211    void endScrubbing(uint64_t contextId);
    212     void seekToTime(uint64_t contextId, double time);
     212    void seekToTime(uint64_t contextId, double time, double before, double after);
    213213    void fastSeek(uint64_t contextId, double time);
    214214    void beginScanningForward(uint64_t contextId);
  • trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm

    r222896 r224085  
    8787}
    8888
    89 void PlaybackSessionModelContext::seekToTime(double time)
    90 {
    91     if (m_manager)
    92         m_manager->seekToTime(m_contextId, time);
     89void PlaybackSessionModelContext::seekToTime(double time, double toleranceBefore, double toleranceAfter)
     90{
     91    if (m_manager)
     92        m_manager->seekToTime(m_contextId, time, toleranceBefore, toleranceAfter);
    9393}
    9494
     
    495495}
    496496
    497 void PlaybackSessionManagerProxy::seekToTime(uint64_t contextId, double time)
    498 {
    499     m_page->send(Messages::PlaybackSessionManager::SeekToTime(contextId, time), m_page->pageID());
     497void PlaybackSessionManagerProxy::seekToTime(uint64_t contextId, double time, double toleranceBefore, double toleranceAfter)
     498{
     499    m_page->send(Messages::PlaybackSessionManager::SeekToTime(contextId, time, toleranceBefore, toleranceAfter), m_page->pageID());
    500500}
    501501
  • trunk/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h

    r220504 r224085  
    147147    void beginScrubbing(uint64_t contextId);
    148148    void endScrubbing(uint64_t contextId);
    149     void seekToTime(uint64_t contextId, double time);
     149    void seekToTime(uint64_t contextId, double time, double toleranceBefore, double toleranceAfter);
    150150    void fastSeek(uint64_t contextId, double time);
    151151    void beginScanningForward(uint64_t contextId);
  • trunk/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in

    r219996 r224085  
    2929    BeginScrubbing(uint64_t contextId)
    3030    EndScrubbing(uint64_t contextId)
    31     SeekToTime(uint64_t contextId, double time)
     31    SeekToTime(uint64_t contextId, double time, double toleranceBefore, double toleranceAfter)
    3232    FastSeek(uint64_t contextId, double time)
    3333    BeginScanningForward(uint64_t contextId)
  • trunk/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm

    r220504 r224085  
    410410}
    411411
    412 void PlaybackSessionManager::seekToTime(uint64_t contextId, double time)
    413 {
    414     UserGestureIndicator indicator(ProcessingUserGesture);
    415     ensureModel(contextId).seekToTime(time);
     412void PlaybackSessionManager::seekToTime(uint64_t contextId, double time, double toleranceBefore, double toleranceAfter)
     413{
     414    UserGestureIndicator indicator(ProcessingUserGesture);
     415    ensureModel(contextId).seekToTime(time, toleranceBefore, toleranceAfter);
    416416}
    417417
Note: See TracChangeset for help on using the changeset viewer.