2026-02-23 23:21:16 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2026, The Ladybird developers
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2026-04-21 19:03:28 -03:00
|
|
|
#include <LibWeb/Bindings/MediaStreamTrackEvent.h>
|
2026-02-23 23:21:16 -03:00
|
|
|
#include <LibWeb/MediaCapture/MediaStreamTrackEvent.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::MediaCapture {
|
|
|
|
|
|
|
|
|
|
GC_DEFINE_ALLOCATOR(MediaStreamTrackEvent);
|
|
|
|
|
|
2026-05-01 14:01:23 -03:00
|
|
|
GC::Ref<MediaStreamTrackEvent> MediaStreamTrackEvent::create(JS::Realm& realm, FlyString const& event_name, Bindings::MediaStreamTrackEventInit const& event_init)
|
2026-02-23 23:21:16 -03:00
|
|
|
{
|
|
|
|
|
return realm.create<MediaStreamTrackEvent>(realm, event_name, event_init);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-01 14:01:23 -03:00
|
|
|
GC::Ref<MediaStreamTrackEvent> MediaStreamTrackEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, Bindings::MediaStreamTrackEventInit const& event_init)
|
2026-02-23 23:21:16 -03:00
|
|
|
{
|
|
|
|
|
return create(realm, event_name, event_init);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// https://w3c.github.io/mediacapture-main/#mediastreamtrackevent
|
2026-05-01 14:01:23 -03:00
|
|
|
MediaStreamTrackEvent::MediaStreamTrackEvent(JS::Realm& realm, FlyString const& event_name, Bindings::MediaStreamTrackEventInit const& event_init)
|
2026-05-20 15:58:46 -03:00
|
|
|
: DOM::Event(realm, event_name, event_init)
|
|
|
|
|
, m_track(event_init.track)
|
2026-02-23 23:21:16 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MediaStreamTrackEvent::~MediaStreamTrackEvent() = default;
|
|
|
|
|
|
|
|
|
|
void MediaStreamTrackEvent::initialize(JS::Realm& realm)
|
|
|
|
|
{
|
|
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaStreamTrackEvent);
|
|
|
|
|
Base::initialize(realm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MediaStreamTrackEvent::visit_edges(Cell::Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
|
visitor.visit(m_track);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|