Title: [183965] trunk/Source/WebCore
Revision
183965
Author
d...@apple.com
Date
2015-05-07 17:45:00 -0700 (Thu, 07 May 2015)

Log Message

[iOS] While scrubbing and holding down, video continues to play
https://bugs.webkit.org/show_bug.cgi?id=144776
<rdar://problem/20863757>

Reviewed by Simon Fraser.

When we are scrubbing a video, we should pause playback. As we
let go of the scrubber playback can resume (but only if it was
playing originally).

* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.createControls): Listen for touchstart on the scrubber.
(ControllerIOS.prototype.handleTimelineInput): Call the prototype, but pause if necessary.
(ControllerIOS.prototype.handleTimelineChange): Just moved this to be with the other timeline functions.
(ControllerIOS.prototype.handleTimelineTouchStart): Add the listeners for end and cancel. Remember that we are
potentially about to scrub.
(ControllerIOS.prototype.handleTimelineTouchEnd): Remove the listeners.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (183964 => 183965)


--- trunk/Source/WebCore/ChangeLog	2015-05-08 00:38:00 UTC (rev 183964)
+++ trunk/Source/WebCore/ChangeLog	2015-05-08 00:45:00 UTC (rev 183965)
@@ -1,3 +1,23 @@
+2015-05-07  Dean Jackson  <d...@apple.com>
+
+        [iOS] While scrubbing and holding down, video continues to play
+        https://bugs.webkit.org/show_bug.cgi?id=144776
+        <rdar://problem/20863757>
+
+        Reviewed by Simon Fraser.
+
+        When we are scrubbing a video, we should pause playback. As we
+        let go of the scrubber playback can resume (but only if it was
+        playing originally).
+
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.createControls): Listen for touchstart on the scrubber.
+        (ControllerIOS.prototype.handleTimelineInput): Call the prototype, but pause if necessary.
+        (ControllerIOS.prototype.handleTimelineChange): Just moved this to be with the other timeline functions.
+        (ControllerIOS.prototype.handleTimelineTouchStart): Add the listeners for end and cancel. Remember that we are
+        potentially about to scrub.
+        (ControllerIOS.prototype.handleTimelineTouchEnd): Remove the listeners.
+
 2015-05-07  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Applying a filter on an SVG element, which is larger than 4096 pixels, causes this element to be rendered shifted to the left

Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (183964 => 183965)


--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2015-05-08 00:38:00 UTC (rev 183964)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2015-05-08 00:45:00 UTC (rev 183965)
@@ -145,6 +145,7 @@
         this.listenFor(this.controls.optimizedFullscreenButton, 'touchstart', this.handleOptimizedFullscreenTouchStart);
         this.listenFor(this.controls.optimizedFullscreenButton, 'touchend', this.handleOptimizedFullscreenTouchEnd);
         this.listenFor(this.controls.optimizedFullscreenButton, 'touchcancel', this.handleOptimizedFullscreenTouchCancel);
+        this.listenFor(this.controls.timeline, 'touchstart', this.handleTimelineTouchStart);
         this.stopListeningFor(this.controls.playButton, 'click', this.handlePlayButtonClicked);
 
         this.controls.timeline.style.backgroundImage = '-webkit-canvas(' + this.timelineContextName + ')';
@@ -303,11 +304,6 @@
         return sign + String('0' + intMinutes).slice(intMinutes >= 10 ? -2 : -1) + ":" + String('0' + intSeconds).slice(-2);
     },
 
-    handleTimelineChange: function(event) {
-        Controller.prototype.handleTimelineChange.call(this);
-        this.updateProgress();
-    },
-
     handlePlayButtonTouchStart: function() {
         this.controls.playButton.classList.add('active');
     },
@@ -496,6 +492,32 @@
         return true;
     },
 
+    handleTimelineInput: function(event) {
+        if (this.potentiallyScrubbing)
+            this.video.pause();
+        Controller.prototype.handleTimelineInput.call(this, event);
+    },
+
+    handleTimelineChange: function(event) {
+        Controller.prototype.handleTimelineChange.call(this, event);
+        this.updateProgress();
+    },
+
+    handleTimelineTouchStart: function(event) {
+        this.potentiallyScrubbing = true;
+        this.wasPlayingWhenScrubbingStarted = !this.video.paused;
+        this.listenFor(this.controls.timeline, 'touchend', this.handleTimelineTouchEnd);
+        this.listenFor(this.controls.timeline, 'touchcancel', this.handleTimelineTouchEnd);
+    },
+
+    handleTimelineTouchEnd: function(event) {
+        this.stopListeningFor(this.controls.timeline, 'touchend', this.handleTimelineTouchEnd);
+        this.stopListeningFor(this.controls.timeline, 'touchcancel', this.handleTimelineTouchEnd);
+        this.potentiallyScrubbing = false;
+        if (this.wasPlayingWhenScrubbingStarted && this.video.paused)
+            this.video.play();
+    },
+
     handleReadyStateChange: function(event) {
         Controller.prototype.handleReadyStateChange.call(this, event);
         this.updateControls();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to