Media Controls: Scrubber should be independent of actual video time, causes scrubber...
authorroger_fong@apple.com <roger_fong@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 May 2015 22:25:36 +0000 (22:25 +0000)
committerroger_fong@apple.com <roger_fong@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 May 2015 22:25:36 +0000 (22:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144700.
<rdar://problem/19997548>

Reviewed by Jer Noble.

Update time and timeline during the timeline input event instead of the wrapper's mousemove.
(Controller.prototype.handleWrapperMouseMove):
(Controller.prototype.handleTimelineMouseMove):
(Controller.prototype.drawTimelineBackground):

(Controller.prototype.updateControlsWhileScrubbing):
Updates time and scrubber to reflect timeline user input.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183953 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js

index c0b7dd24aa480f759dc0ab95095eba0bbdea409f..24bad4b43b1f95971a6e917db324c6094045e0a6 100644 (file)
@@ -1,3 +1,19 @@
+2015-05-06  Roger Fong  <roger_fong@apple.com>
+
+        Media Controls: Scrubber should be independent of actual video time, causes scrubber to be jumpy.
+        https://bugs.webkit.org/show_bug.cgi?id=144700.
+        <rdar://problem/19997548>
+
+        Reviewed by Jer Noble.
+
+        Update time and timeline during the timeline input event instead of the wrapper's mousemove.
+        (Controller.prototype.handleWrapperMouseMove):
+        (Controller.prototype.handleTimelineMouseMove):
+        (Controller.prototype.drawTimelineBackground): 
+
+        (Controller.prototype.updateControlsWhileScrubbing): 
+        Updates time and scrubber to reflect timeline user input.
+
 2015-05-07  Yoav Weiss  <yoav@yoav.ws>
 
         Handle meta viewport in HTMLPreloadScanner
index 7c90d55718416d6d1f81a73ebbb3d6dbbb012d5e..87402448373ed8e8c1fd816b1c4c262ef8ac9077 100644 (file)
@@ -762,9 +762,6 @@ Controller.prototype = {
         if (this.controlsAreHidden())
             this.showControls();
         this.resetHideControlsTimer();
-        
-        if (this.scrubbing)
-            this.updateTime();
 
         if (!this.isDragging)
             return;
@@ -855,6 +852,7 @@ Controller.prototype = {
     handleTimelineInput: function(event)
     {
         this.video.fastSeek(this.controls.timeline.value);
+        this.updateControlsWhileScrubbing();
     },
 
     handleTimelineChange: function(event)
@@ -1157,8 +1155,8 @@ Controller.prototype = {
         
         if (!width || !height)
             return;
-        
-        var played = this.video.currentTime / this.video.duration;
+
+        var played = this.controls.timeline.value / this.controls.timeline.max;
         var buffered = 0;
         for (var i = 0, end = this.video.buffered.length; i < end; ++i)
             buffered = Math.max(this.video.buffered.end(i), buffered);
@@ -1408,6 +1406,18 @@ Controller.prototype = {
         this.controls.timeline.value = this.video.currentTime;
         this.controls.remainingTime.innerText = this.formatTime(timeRemaining);
     },
+    
+    updateControlsWhileScrubbing: function()
+    {
+        if (!this.scrubbing)
+            return;
+
+        var currentTime = (this.controls.timeline.value / this.controls.timeline.max) * this.video.duration;
+        var timeRemaining = currentTime - this.video.duration;
+        this.controls.currentTime.innerText = this.formatTime(currentTime);
+        this.controls.remainingTime.innerText = this.formatTime(timeRemaining);
+        this.drawTimelineBackground();
+    },
 
     updateReadyState: function()
     {