Title: [287050] trunk
Revision
287050
Author
[email protected]
Date
2021-12-14 14:36:14 -0800 (Tue, 14 Dec 2021)

Log Message

Safari intermittently stopping playing Spotify Web Player (currentTime goes backwards)
https://bugs.webkit.org/show_bug.cgi?id=233257
<rdar://problem/85504967>

Reviewed by Eric Carlson.

Source/WebKit:

Test: media/video-currentTime-duration.html

Clamp currentMediaTime() to [0, durationMediaTime()].

* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::currentMediaTime const):

LayoutTests:

* media/video-currentTime-duration-expected.txt: Added.
* media/video-currentTime-duration.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287049 => 287050)


--- trunk/LayoutTests/ChangeLog	2021-12-14 22:20:05 UTC (rev 287049)
+++ trunk/LayoutTests/ChangeLog	2021-12-14 22:36:14 UTC (rev 287050)
@@ -1,3 +1,14 @@
+2021-12-14  Jer Noble  <[email protected]>
+
+        Safari intermittently stopping playing Spotify Web Player (currentTime goes backwards)
+        https://bugs.webkit.org/show_bug.cgi?id=233257
+        <rdar://problem/85504967>
+
+        Reviewed by Eric Carlson.
+
+        * media/video-currentTime-duration-expected.txt: Added.
+        * media/video-currentTime-duration.html: Added.
+
 2021-12-14  Tyler Wilcock  <[email protected]>
 
         Web Inspector: test webpage keeps reloading when Inspector is open

Added: trunk/LayoutTests/media/video-currentTime-duration-expected.txt (0 => 287050)


--- trunk/LayoutTests/media/video-currentTime-duration-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-currentTime-duration-expected.txt	2021-12-14 22:36:14 UTC (rev 287050)
@@ -0,0 +1,11 @@
+
+RUN(video.src = "" "content/test"))
+EVENT(canplaythrough)
+RUN(video.currentTime = video.duration - 0.1)
+EVENT(seeked)
+RUN(video.play())
+EVENT(playing)
+EVENT(timeupdate)
+EXPECTED (video.currentTime <= video.duration == 'true') OK
+END OF TEST
+

Added: trunk/LayoutTests/media/video-currentTime-duration.html (0 => 287050)


--- trunk/LayoutTests/media/video-currentTime-duration.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-currentTime-duration.html	2021-12-14 22:36:14 UTC (rev 287050)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>video-currentTime-duration</title>
+    <script src=""
+    <script src=""
+    <script>
+    window.addEventListener('load', async event => {
+        findMediaElement();
+        run('video.src = "" "content/test")');
+        await waitFor(video, 'canplaythrough');
+        run('video.currentTime = video.duration - 0.1');
+        await waitFor(video, 'seeked');
+        run('video.play()');
+        await waitFor(video, 'playing');
+        await waitFor(video, 'timeupdate');
+        testExpected('video.currentTime <= video.duration', true);
+        endTest();
+    });
+    </script>
+</head>
+<body>
+    <video muted></video>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebKit/ChangeLog (287049 => 287050)


--- trunk/Source/WebKit/ChangeLog	2021-12-14 22:20:05 UTC (rev 287049)
+++ trunk/Source/WebKit/ChangeLog	2021-12-14 22:36:14 UTC (rev 287050)
@@ -1,3 +1,18 @@
+2021-12-14  Jer Noble  <[email protected]>
+
+        Safari intermittently stopping playing Spotify Web Player (currentTime goes backwards)
+        https://bugs.webkit.org/show_bug.cgi?id=233257
+        <rdar://problem/85504967>
+
+        Reviewed by Eric Carlson.
+
+        Test: media/video-currentTime-duration.html
+
+        Clamp currentMediaTime() to [0, durationMediaTime()].
+
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+        (WebKit::MediaPlayerPrivateRemote::currentMediaTime const):
+
 2021-12-14  Alex Christensen  <[email protected]>
 
         Revert r284816

Modified: trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp (287049 => 287050)


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2021-12-14 22:20:05 UTC (rev 287049)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2021-12-14 22:36:14 UTC (rev 287050)
@@ -285,7 +285,8 @@
     if (!m_timeIsProgressing)
         return m_cachedMediaTime;
 
-    return m_cachedMediaTime + MediaTime::createWithDouble(m_rate * (MonotonicTime::now() - m_cachedMediaTimeQueryTime).seconds());
+    auto calculatedCurrentTime = m_cachedMediaTime + MediaTime::createWithDouble(m_rate * (MonotonicTime::now() - m_cachedMediaTimeQueryTime).seconds());
+    return std::min(std::max(calculatedCurrentTime, MediaTime::zeroTime()), durationMediaTime());
 }
 
 void MediaPlayerPrivateRemote::seek(const MediaTime& time)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to