MediaError.h 919 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. public:
  14. enum class Code : u16 {
  15. Aborted = 1,
  16. Network = 2,
  17. Decode = 3,
  18. SrcNotSupported = 4,
  19. };
  20. Code code() const { return m_code; }
  21. String const& message() const { return m_message; }
  22. private:
  23. MediaError(JS::Realm&, Code code, String message);
  24. virtual void initialize(JS::Realm&) override;
  25. // https://html.spec.whatwg.org/multipage/media.html#dom-mediaerror-code
  26. Code m_code;
  27. // https://html.spec.whatwg.org/multipage/media.html#dom-mediaerror-message
  28. String m_message;
  29. };
  30. }