MediaError.h 957 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. #include <LibJS/Forward.h>
  9. #include <LibWeb/Bindings/PlatformObject.h>
  10. namespace Web::HTML {
  11. class MediaError final : public Bindings::PlatformObject {
  12. WEB_PLATFORM_OBJECT(MediaError, Bindings::PlatformObject);
  13. JS_DECLARE_ALLOCATOR(MediaError);
  14. public:
  15. enum class Code : u16 {
  16. Aborted = 1,
  17. Network = 2,
  18. Decode = 3,
  19. SrcNotSupported = 4,
  20. };
  21. Code code() const { return m_code; }
  22. String const& message() const { return m_message; }
  23. private:
  24. MediaError(JS::Realm&, Code code, String message);
  25. virtual void initialize(JS::Realm&) override;
  26. // https://html.spec.whatwg.org/multipage/media.html#dom-mediaerror-code
  27. Code m_code;
  28. // https://html.spec.whatwg.org/multipage/media.html#dom-mediaerror-message
  29. String m_message;
  30. };
  31. }