HTMLVideoElement.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGfx/Forward.h>
  8. #include <LibWeb/Forward.h>
  9. #include <LibWeb/HTML/HTMLMediaElement.h>
  10. namespace Web::HTML {
  11. class HTMLVideoElement final : public HTMLMediaElement {
  12. WEB_PLATFORM_OBJECT(HTMLVideoElement, HTMLMediaElement);
  13. public:
  14. virtual ~HTMLVideoElement() override;
  15. Layout::VideoBox* layout_node();
  16. Layout::VideoBox const* layout_node() const;
  17. void set_video_width(u32 video_width) { m_video_width = video_width; }
  18. u32 video_width() const;
  19. void set_video_height(u32 video_height) { m_video_height = video_height; }
  20. u32 video_height() const;
  21. void set_video_track(JS::GCPtr<VideoTrack>);
  22. void set_current_frame(Badge<VideoTrack>, RefPtr<Gfx::Bitmap> frame);
  23. RefPtr<Gfx::Bitmap> const& current_frame() const { return m_current_frame; }
  24. private:
  25. HTMLVideoElement(DOM::Document&, DOM::QualifiedName);
  26. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  27. virtual void visit_edges(Cell::Visitor&) override;
  28. virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
  29. virtual void on_playing() override;
  30. virtual void on_paused() override;
  31. JS::GCPtr<HTML::VideoTrack> m_video_track;
  32. RefPtr<Gfx::Bitmap> m_current_frame;
  33. u32 m_video_width { 0 };
  34. u32 m_video_height { 0 };
  35. };
  36. }