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