HTMLVideoElement.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. RefPtr<Gfx::Bitmap> const& current_frame() const { return m_current_frame; }
  23. private:
  24. HTMLVideoElement(DOM::Document&, DOM::QualifiedName);
  25. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  26. virtual void visit_edges(Cell::Visitor&) override;
  27. virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
  28. virtual void on_playing() override;
  29. virtual void on_paused() override;
  30. JS::GCPtr<HTML::VideoTrack> m_video_track;
  31. RefPtr<Platform::Timer> m_video_timer;
  32. RefPtr<Gfx::Bitmap> m_current_frame;
  33. u32 m_video_width { 0 };
  34. u32 m_video_height { 0 };
  35. };
  36. }