mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
The two classes now inherit from a common base MediaTrackBase, to deduplicate the attributes that are shared between the two. The integer ID from the container is used for each track's id attribute. The kind attribute is set to "main" or "translation" according to: https://dev.w3.org/html5/html-sourcing-inband-tracks/ The label attribute is set to the human-readable name of the track, if one is present. The language attribute is set to a BCP 47 language tag, if one can be parsed successfully.
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
|
* Copyright (c) 2025, Gregory Bertilson <gregory@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/String.h>
|
|
#include <AK/Time.h>
|
|
#include <LibMedia/Track.h>
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
#include <LibWeb/HTML/MediaTrackBase.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
class VideoTrack final : public MediaTrackBase {
|
|
WEB_PLATFORM_OBJECT(VideoTrack, MediaTrackBase);
|
|
GC_DECLARE_ALLOCATOR(VideoTrack);
|
|
|
|
public:
|
|
virtual ~VideoTrack() override;
|
|
|
|
void set_video_track_list(Badge<VideoTrackList>, GC::Ptr<VideoTrackList> video_track_list) { m_video_track_list = video_track_list; }
|
|
|
|
bool selected() const { return m_selected; }
|
|
void set_selected(bool selected);
|
|
|
|
private:
|
|
VideoTrack(JS::Realm&, GC::Ref<HTMLMediaElement>, Media::Track const& track);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
// https://html.spec.whatwg.org/multipage/media.html#dom-videotrack-selected
|
|
bool m_selected { false };
|
|
|
|
GC::Ptr<VideoTrackList> m_video_track_list;
|
|
};
|
|
|
|
}
|