LibWeb: Add MediaSourceExtensions events

Continuing the boilerplate for these interfaces.
This commit is contained in:
Shannon Booth 2024-11-18 12:13:48 +13:00 committed by Luke Wilde
parent ff791a63fc
commit 66530086a4
Notes: github-actions[bot] 2024-11-18 10:59:22 +00:00
19 changed files with 280 additions and 13 deletions

View file

@ -6,6 +6,7 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/ManagedMediaSourcePrototype.h>
#include <LibWeb/MediaSourceExtensions/EventNames.h>
#include <LibWeb/MediaSourceExtensions/ManagedMediaSource.h>
namespace Web::MediaSourceExtensions {
@ -30,4 +31,28 @@ void ManagedMediaSource::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(ManagedMediaSource);
}
// https://w3c.github.io/media-source/#dom-managedmediasource-onstartstreaming
void ManagedMediaSource::set_onstartstreaming(GC::Ptr<WebIDL::CallbackType> event_handler)
{
set_event_handler_attribute(EventNames::startstreaming, event_handler);
}
// https://w3c.github.io/media-source/#dom-managedmediasource-onstartstreaming
GC::Ptr<WebIDL::CallbackType> ManagedMediaSource::onstartstreaming()
{
return event_handler_attribute(EventNames::startstreaming);
}
// https://w3c.github.io/media-source/#dom-managedmediasource-onendstreaming
void ManagedMediaSource::set_onendstreaming(GC::Ptr<WebIDL::CallbackType> event_handler)
{
set_event_handler_attribute(EventNames::endstreaming, event_handler);
}
// https://w3c.github.io/media-source/#dom-managedmediasource-onendstreaming
GC::Ptr<WebIDL::CallbackType> ManagedMediaSource::onendstreaming()
{
return event_handler_attribute(EventNames::endstreaming);
}
}