mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-17 15:51:55 +00:00
LibWeb: Implement the HTMLMediaElement paused attribute
Note that the default value of the attribute is true. We were previously autoplaying videos as soon as they loaded - this will prevent that from happening until the paused attribute is set to false.
This commit is contained in:
parent
e130525c24
commit
90921a4f16
Notes:
sideshowbarker
2024-07-17 00:16:31 +09:00
Author: https://github.com/trflynn89
Commit: 90921a4f16
Pull-request: https://github.com/SerenityOS/serenity/pull/18233
Reviewed-by: https://github.com/linusg
5 changed files with 68 additions and 7 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -84,9 +85,10 @@ void HTMLVideoElement::set_video_track(JS::GCPtr<HTML::VideoTrack> video_track)
|
|||
m_video_timer->stop();
|
||||
|
||||
m_video_track = video_track;
|
||||
if (!m_video_track)
|
||||
return;
|
||||
}
|
||||
|
||||
void HTMLVideoElement::on_playing()
|
||||
{
|
||||
if (!m_video_timer) {
|
||||
m_video_timer = Platform::Timer::create_repeating(s_frame_delay_ms, [this]() {
|
||||
if (auto frame = m_video_track->next_frame())
|
||||
|
@ -101,4 +103,10 @@ void HTMLVideoElement::set_video_track(JS::GCPtr<HTML::VideoTrack> video_track)
|
|||
m_video_timer->start();
|
||||
}
|
||||
|
||||
void HTMLVideoElement::on_paused()
|
||||
{
|
||||
if (m_video_timer)
|
||||
m_video_timer->stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue