Add support for HTMLMediaElement.fastSeek()
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Nov 2013 18:30:03 +0000 (18:30 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Nov 2013 18:30:03 +0000 (18:30 +0000)
commit301f5cade47e5360cdf3e59f9a70b24cde1b4161
tree57debef20b82219e6f38eba58119818d44c0020e
parent5f9616107de2ee31ca45f974ea3f47f8cdba950d
Add support for HTMLMediaElement.fastSeek()
https://bugs.webkit.org/show_bug.cgi?id=124262

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/video-fast-seek.html

Add the fastSeek() method to HTMLMediaElement, and use fastSeek() in
the JavaScript media controls.

Add the new fastSeek() method:
* html/HTMLMediaElement.cpp:
(HTMLMediaElement::fastSeek): Call seekWithTolerance.
(HTMLMediaElement::seek): Call seekWithTolerance with 0 tolerance.
(HTMLMediaElement::seekWithTolerance): Renamed from seek().
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.idl:

Add seekWithTolerance() to MediaPlayer:
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::seekWithTolerance): Pass to MediaPlayerPrivate.
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::seekWithTolerance): Default implementation which
    calls seek().
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::seek): Call seekWithTolerance with 0 tolerance.
(WebCore::MediaPlayerPrivateAVFoundation::seekWithTolerance): Renamed from seek().
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime): Take tolerance parameters.

Use the new fastSeek() method while actively scrubbing.
* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.createControls): Add mouse up and down handlers.
(Controller.prototype.handleTimeUpdate): Only update the timeline when not scrubbing.
(Controller.prototype.handleTimelineChange): Use fastSeek().
(Controller.prototype.handleTimelineMouseDown): Start scrubbing.
(Controller.prototype.handleTimelineMouseUp): Stop scrubbing.

LayoutTests:

* media/video-fast-seek-expected.txt: Added.
* media/video-fast-seek.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/media/video-fast-seek-expected.txt [new file with mode: 0644]
LayoutTests/media/video-fast-seek.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLMediaElement.idl
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm