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/MediaSourcePrototype.h>
#include <LibWeb/MediaSourceExtensions/EventNames.h>
#include <LibWeb/MediaSourceExtensions/MediaSource.h>
namespace Web::MediaSourceExtensions {
@ -30,4 +31,40 @@ void MediaSource::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaSource);
}
// https://w3c.github.io/media-source/#dom-mediasource-onsourceopen
void MediaSource::set_onsourceopen(GC::Ptr<WebIDL::CallbackType> event_handler)
{
set_event_handler_attribute(EventNames::sourceopen, event_handler);
}
// https://w3c.github.io/media-source/#dom-mediasource-onsourceopen
GC::Ptr<WebIDL::CallbackType> MediaSource::onsourceopen()
{
return event_handler_attribute(EventNames::sourceopen);
}
// https://w3c.github.io/media-source/#dom-mediasource-onsourceended
void MediaSource::set_onsourceended(GC::Ptr<WebIDL::CallbackType> event_handler)
{
set_event_handler_attribute(EventNames::sourceended, event_handler);
}
// https://w3c.github.io/media-source/#dom-mediasource-onsourceended
GC::Ptr<WebIDL::CallbackType> MediaSource::onsourceended()
{
return event_handler_attribute(EventNames::sourceended);
}
// https://w3c.github.io/media-source/#dom-mediasource-onsourceclose
void MediaSource::set_onsourceclose(GC::Ptr<WebIDL::CallbackType> event_handler)
{
set_event_handler_attribute(EventNames::sourceclose, event_handler);
}
// https://w3c.github.io/media-source/#dom-mediasource-onsourceclose
GC::Ptr<WebIDL::CallbackType> MediaSource::onsourceclose()
{
return event_handler_attribute(EventNames::sourceclose);
}
}