10000 Let MediaController.currentTime return the position previously set · WebKit/WebKit@921f824 · GitHub
[go: up one dir, main page]

Skip to content

Commit 921f824

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
Let MediaController.currentTime return the position previously set
Let MediaController.currentTime return the position previously set https://bugs.webkit.org/show_bug.cgi?id=250594 Reviewed by Eric Carlson. This patch is to align WebKit with Web-Specification: Web-Spec: https://html.spec.whatwg.org/multipage/media.html#seeking "Set the current playback position to the new playback position." This patch modifies 'setCurrenTime' function to have "m_position" as "time" and return it according to web-specification. Merge - http://src.chromium.org/viewvc/blink?view=rev&rev=170504 * Source/WebCore/html/MediaController.cpp: (MediaController::setCurrentTime): Add 'm_position = time;" for Step 11 of Web-Spec * LayoutTests/media/media-controller-playback.html: Add new sub-test * LayoutTests/media/media-controller-playback-expected.txt: Add new sub-test expectations Canonical link: https://commits.webkit.org/259020@main
1 parent 3612aa5 commit 921f824

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

LayoutTests/media/media-controller-playback-expected.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RUN(controller.play())
55
EVENT(playing)
66
EXPECTED (controller.paused == 'false') OK
77
RUN(controller.currentTime = 5)
8+
EXPECTED (controller.currentTime == '5') OK
89
EXPECTED (video.currentTime == '5') OK
910
EXPECTED (video2.currentTime == '5') OK
1011
EVENT(ended)

LayoutTests/media/media-controller-playback.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
testExpected('controller.paused', false);
3333
controller.addEventListener('ended', ended, true);
3434
run('controller.currentTime = 5');
35+
testExpected('controller.currentTime', 5);
3536
testExpected('video.currentTime', 5);
3637
testExpected('video2.currentTime', 5);
3738
}

Source/WebCore/html/MediaController.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
2-
* Copyright (C) 2011 Apple Inc. All rights reserved.
2+
* Copyright (C) 2011-2023 Apple Inc. All rights reserved.
3+
* Copyright (C) 2014 Google Inc. All rights reserved.
34
*
45
* Redistribution and use in source and binary forms, with or without
56
* modification, are permitted provided that the following conditions
@@ -166,6 +167,7 @@ void MediaController::setCurrentTime(double time)
166167
time = std::min(time, duration());
167168

168169
// Set the media controller position to the new playback position.
170+
m_position = time;
169171
m_clock->setCurrentTime(time);
170172

171173
// Seek each mediagroup element to the new playback position relative to the media element timeline.

0 commit comments

Comments
 (0)
0