ladybird/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h
Timothy Flynn edf85d39c6 LibWeb: Port HTMLVideoElement to play videos with Video::PlaybackManager
This has several advantages over the current manual demuxing currently
being performed. PlaybackManager hides the specific demuxer being used,
which will allow more codecs to be added transparently to LibWeb. It
also provides buffering and controls playback rate for us.

Further, it will allow us to much more easily implement the "media
timeline" to render a timestamp and implement seeking.
2023-04-09 23:55:05 +02:00

53 lines
1.4 KiB
C++

/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/Forward.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/HTMLMediaElement.h>
namespace Web::HTML {
class HTMLVideoElement final : public HTMLMediaElement {
WEB_PLATFORM_OBJECT(HTMLVideoElement, HTMLMediaElement);
public:
virtual ~HTMLVideoElement() override;
Layout::VideoBox* layout_node();
Layout::VideoBox const* layout_node() const;
void set_video_width(u32 video_width) { m_video_width = video_width; }
u32 video_width() const;
void set_video_height(u32 video_height) { m_video_height = video_height; }
u32 video_height() const;
void set_video_track(JS::GCPtr<VideoTrack>);
void set_current_frame(Badge<VideoTrack>, RefPtr<Gfx::Bitmap> frame);
RefPtr<Gfx::Bitmap> const& current_frame() const { return m_current_frame; }
private:
HTMLVideoElement(DOM::Document&, DOM::QualifiedName);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
virtual void on_playing() override;
virtual void on_paused() override;
JS::GCPtr<HTML::VideoTrack> m_video_track;
RefPtr<Gfx::Bitmap> m_current_frame;
u32 m_video_width { 0 };
u32 m_video_height { 0 };
};
}