diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-04-25 08:54:04 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-25 18:02:22 +0200 |
commit | 78ad47136713c7874988d2abbf8dd3618991f8ba (patch) | |
tree | dd0562e826614ceb5f8c6b03ee73650b705cf06a /Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp | |
parent | e5b97f4a576d6b4e1bf9686b2dc00d65c5ff90ac (diff) | |
download | serenity-78ad47136713c7874988d2abbf8dd3618991f8ba.zip |
LibWeb: Remove custom playback timer from HTMLMediaElement
After the EventLoop changes, we do not need to override LibVideo's timer
with a Qt timer for Ladybird. The timer callback provided here also does
not need the JS::SafeFunction wrapper that Platform::Timer provides.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index c483bab47c..db2e59b2f4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -28,31 +28,10 @@ #include <LibWeb/HTML/VideoTrack.h> #include <LibWeb/HTML/VideoTrackList.h> #include <LibWeb/MimeSniff/MimeType.h> -#include <LibWeb/Platform/Timer.h> #include <LibWeb/WebIDL/Promise.h> namespace Web::HTML { -class MediaElementPlaybackTimer final : public Video::PlaybackTimer { -public: - static ErrorOr<NonnullOwnPtr<MediaElementPlaybackTimer>> create(int interval_ms, Function<void()> timeout_handler) - { - auto timer = Platform::Timer::create_single_shot(interval_ms, move(timeout_handler)); - return adopt_nonnull_own_or_enomem(new (nothrow) MediaElementPlaybackTimer(move(timer))); - } - - virtual void start() override { m_timer->start(); } - virtual void start(int interval_ms) override { m_timer->start(interval_ms); } - -private: - explicit MediaElementPlaybackTimer(NonnullRefPtr<Platform::Timer> timer) - : m_timer(move(timer)) - { - } - - NonnullRefPtr<Platform::Timer> m_timer; -}; - HTMLMediaElement::HTMLMediaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) , m_pending_play_promises(heap()) @@ -773,9 +752,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void(Str auto& realm = this->realm(); auto& vm = realm.vm(); - auto playback_manager = Video::PlaybackManager::from_data(m_media_data, [](auto interval_ms, auto timeout_handler) { - return MediaElementPlaybackTimer::create(interval_ms, move(timeout_handler)); - }); + auto playback_manager = Video::PlaybackManager::from_data(m_media_data); // -> If the media data cannot be fetched at all, due to network errors, causing the user agent to give up trying to fetch the resource // -> If the media data can be fetched but is found by inspection to be in an unsupported format, or can otherwise not be rendered at all |