/* * Copyright (c) 2023, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Web::HTML { class VideoTrackList final : public DOM::EventTarget { WEB_PLATFORM_OBJECT(VideoTrackList, DOM::EventTarget); public: ErrorOr add_track(Badge, JS::NonnullGCPtr); void remove_all_tracks(Badge); Span> video_tracks(Badge) { return m_video_tracks; } // https://html.spec.whatwg.org/multipage/media.html#dom-videotracklist-length size_t length() const { return m_video_tracks.size(); } JS::GCPtr get_track_by_id(StringView id) const; i32 selected_index() const; void set_onchange(WebIDL::CallbackType*); WebIDL::CallbackType* onchange(); void set_onaddtrack(WebIDL::CallbackType*); WebIDL::CallbackType* onaddtrack(); void set_onremovetrack(WebIDL::CallbackType*); WebIDL::CallbackType* onremovetrack(); private: explicit VideoTrackList(JS::Realm&); virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; virtual JS::ThrowCompletionOr> internal_get_own_property(JS::PropertyKey const& property_name) const override; JS::MarkedVector> m_video_tracks; }; }