Commit 6e84da2
committed
[Media] Avoid play() call during seek flow before the finishSeek()
https://bugs.webkit.org/show_bug.cgi?id=283172
Reviewed by Xabier Rodriguez-Calvar.
During the video playback states should ideally flow as play -> pause ->
seek_start -> seek_done -> play, but randomly it is observed that the
play event is being sent before finishing the seek (seek_done) i.e, play
-> pause -> seek_start -> play -> seek_done. Ideally play call might be
triggered continuously by the webapp when we are playing a video, so in
our scenario between seek_start and seek_done we should avoid the play
call.
This commit adds a new condition to skip the playPlayer() call during
updatePlayState() when the seek is ongoing. This would avoid the play
event to happen.
There's also some special cases to not skip playPlayer() on first play,
because initial seeks aren't fully supported on WebKitGTK/WPE and that
play call might be required for them to work:
- First time playing
- Looping
- Resuming playback
- Seek after playback ended (either as part of a loop or a manual seek)
See: #1423
Co-authored with: gowthami <gchikkadasarahallilo.ext@libertyglobal.com>
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::seekWithTolerance): Set seek after playback ended flag when the current position is equal to duration.
(WebCore::HTMLMediaElement::finishSeek): Reset the seek after playback ended flag.
(WebCore::HTMLMediaElement::playInternal): Set seek after playback ended flag when needed.
(WebCore::HTMLMediaElement::updatePlayState): Add the new conditions and exceptions to disallow playback when seeking.
(WebCore::HTMLMediaElement::mayResumePlayback): Set the isResumingPlayback condition and reset it after the call to play().
* Source/WebCore/html/HTMLMediaElement.h: Added m_isResumingPlayback and m_seekAfterPlaybackEnded flags.
Canonical link: https://commits.webkit.org/287274@main1 parent d893a3e commit 6e84da2
2 files changed
Lines changed: 26 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3212 | 3212 | | |
3213 | 3213 | | |
3214 | 3214 | | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
3215 | 3219 | | |
3216 | 3220 | | |
3217 | 3221 | | |
| |||
3383 | 3387 | | |
3384 | 3388 | | |
3385 | 3389 | | |
| 3390 | + | |
| 3391 | + | |
3386 | 3392 | | |
3387 | 3393 | | |
3388 | 3394 | | |
| |||
3804 | 3810 | | |
3805 | 3811 | | |
3806 | 3812 | | |
3807 | | - | |
| 3813 | + | |
| 3814 | + | |
3808 | 3815 | | |
| 3816 | + | |
3809 | 3817 | | |
3810 | 3818 | | |
3811 | 3819 | | |
| |||
5768 | 5776 | | |
5769 | 5777 | | |
5770 | 5778 | | |
5771 | | - | |
| 5779 | + | |
| 5780 | + | |
| 5781 | + | |
| 5782 | + | |
| 5783 | + | |
| 5784 | + | |
| 5785 | + | |
| 5786 | + | |
| 5787 | + | |
| 5788 | + | |
| 5789 | + | |
5772 | 5790 | | |
5773 | 5791 | | |
5774 | 5792 | | |
| |||
8113 | 8131 | | |
8114 | 8132 | | |
8115 | 8133 | | |
8116 | | - | |
| 8134 | + | |
| 8135 | + | |
8117 | 8136 | | |
| 8137 | + | |
| 8138 | + | |
8118 | 8139 | | |
8119 | 8140 | | |
8120 | 8141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1162 | 1162 | | |
1163 | 1163 | | |
1164 | 1164 | | |
| 1165 | + | |
| 1166 | + | |
1165 | 1167 | | |
1166 | 1168 | | |
1167 | 1169 | | |
| |||
0 commit comments