mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
LibWeb: Add stubbed Media Source Extensions API
Just the boilerplate :^)
This commit is contained in:
parent
3e3851983d
commit
3504370281
Notes:
github-actions[bot]
2024-11-01 17:24:36 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/35043702813 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2102
30 changed files with 604 additions and 0 deletions
|
@ -90,10 +90,12 @@ static bool is_platform_object(Type const& type)
|
|||
"ServiceWorkerRegistration"sv,
|
||||
"SVGTransform"sv,
|
||||
"ShadowRoot"sv,
|
||||
"SourceBuffer"sv,
|
||||
"Table"sv,
|
||||
"Text"sv,
|
||||
"TextMetrics"sv,
|
||||
"TextTrack"sv,
|
||||
"TimeRanges"sv,
|
||||
"URLSearchParams"sv,
|
||||
"VTTRegion"sv,
|
||||
"VideoTrack"sv,
|
||||
|
@ -4240,6 +4242,7 @@ static void generate_using_namespace_definitions(SourceGenerator& generator)
|
|||
using namespace Web::Internals;
|
||||
using namespace Web::IntersectionObserver;
|
||||
using namespace Web::MediaCapabilitiesAPI;
|
||||
using namespace Web::MediaSourceExtensions;
|
||||
using namespace Web::NavigationTiming;
|
||||
using namespace Web::PerformanceTimeline;
|
||||
using namespace Web::RequestIdleCallback;
|
||||
|
|
|
@ -28,6 +28,7 @@ static constexpr Array libweb_interface_namespaces = {
|
|||
"Internals"sv,
|
||||
"IntersectionObserver"sv,
|
||||
"MathML"sv,
|
||||
"MediaSourceExtensions"sv,
|
||||
"NavigationTiming"sv,
|
||||
"RequestIdleCallback"sv,
|
||||
"ResizeObserver"sv,
|
||||
|
|
|
@ -319,6 +319,7 @@ shared_library("LibWeb") {
|
|||
"Loader",
|
||||
"MathML",
|
||||
"MediaCapabilitiesAPI",
|
||||
"MediaSourceExtensions",
|
||||
"MimeSniff",
|
||||
"MixedContent",
|
||||
"NavigationTiming",
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
source_set("MediaSourceExtensions") {
|
||||
configs += [ "//Userland/Libraries/LibWeb:configs" ]
|
||||
deps = [ "//Userland/Libraries/LibWeb:all_generated" ]
|
||||
sources = [
|
||||
"BufferedChangeEvent.cpp",
|
||||
"ManagedMediaSource.cpp",
|
||||
"ManagedSourceBuffer.cpp",
|
||||
"MediaSource.cpp",
|
||||
"MediaSourceHandle.cpp",
|
||||
"SourceBuffer.cpp",
|
||||
"SourceBufferList.cpp",
|
||||
]
|
||||
}
|
|
@ -268,6 +268,13 @@ standard_idl_files = [
|
|||
"//Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserverEntry.idl",
|
||||
"//Userland/Libraries/LibWeb/MathML/MathMLElement.idl",
|
||||
"//Userland/Libraries/LibWeb/MediaCapabilitiesAPI/MediaCapabilities.idl",
|
||||
"//Userland/Libraries/LibWeb/MediaSourceExtensions/BufferedChangeEvent.idl",
|
||||
"//Userland/Libraries/LibWeb/MediaSourceExtensions/ManagedMediaSource.idl",
|
||||
"//Userland/Libraries/LibWeb/MediaSourceExtensions/ManagedSourceBuffer.idl",
|
||||
"//Userland/Libraries/LibWeb/MediaSourceExtensions/MediaSource.idl",
|
||||
"//Userland/Libraries/LibWeb/MediaSourceExtensions/MediaSourceHandle.idl",
|
||||
"//Userland/Libraries/LibWeb/MediaSourceExtensions/SourceBuffer.idl",
|
||||
"//Userland/Libraries/LibWeb/MediaSourceExtensions/SourceBufferList.idl",
|
||||
"//Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.idl",
|
||||
"//Userland/Libraries/LibWeb/NavigationTiming/PerformanceNavigation.idl",
|
||||
"//Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceEntry.idl",
|
||||
|
|
|
@ -30,6 +30,7 @@ BiquadFilterNode
|
|||
Blob
|
||||
Boolean
|
||||
BroadcastChannel
|
||||
BufferedChangeEvent
|
||||
ByteLengthQueuingStrategy
|
||||
CDATASection
|
||||
CSSAnimation
|
||||
|
@ -212,6 +213,8 @@ Iterator
|
|||
KeyboardEvent
|
||||
KeyframeEffect
|
||||
Location
|
||||
ManagedMediaSource
|
||||
ManagedSourceBuffer
|
||||
Map
|
||||
MathMLElement
|
||||
MediaCapabilities
|
||||
|
@ -219,6 +222,8 @@ MediaError
|
|||
MediaList
|
||||
MediaQueryList
|
||||
MediaQueryListEvent
|
||||
MediaSource
|
||||
MediaSourceHandle
|
||||
MessageChannel
|
||||
MessageEvent
|
||||
MessagePort
|
||||
|
@ -335,6 +340,8 @@ Set
|
|||
ShadowRealm
|
||||
ShadowRoot
|
||||
SharedArrayBuffer
|
||||
SourceBuffer
|
||||
SourceBufferList
|
||||
StaticRange
|
||||
Storage
|
||||
StorageManager
|
||||
|
|
|
@ -563,6 +563,13 @@ set(SOURCES
|
|||
MathML/MathMLElement.cpp
|
||||
MathML/TagNames.cpp
|
||||
MediaCapabilitiesAPI/MediaCapabilities.cpp
|
||||
MediaSourceExtensions/BufferedChangeEvent.cpp
|
||||
MediaSourceExtensions/ManagedMediaSource.cpp
|
||||
MediaSourceExtensions/ManagedSourceBuffer.cpp
|
||||
MediaSourceExtensions/MediaSource.cpp
|
||||
MediaSourceExtensions/MediaSourceHandle.cpp
|
||||
MediaSourceExtensions/SourceBuffer.cpp
|
||||
MediaSourceExtensions/SourceBufferList.cpp
|
||||
MimeSniff/MimeType.cpp
|
||||
MimeSniff/Resource.cpp
|
||||
MixedContent/AbstractOperations.cpp
|
||||
|
|
|
@ -623,6 +623,16 @@ namespace Web::MediaCapabilitiesAPI {
|
|||
class MediaCapabilities;
|
||||
}
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
class BufferedChangeEvent;
|
||||
class ManagedMediaSource;
|
||||
class ManagedSourceBuffer;
|
||||
class MediaSource;
|
||||
class MediaSourceHandle;
|
||||
class SourceBuffer;
|
||||
class SourceBufferList;
|
||||
}
|
||||
|
||||
namespace Web::MimeSniff {
|
||||
class MimeType;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/BufferedChangeEventPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/MediaSourceExtensions/BufferedChangeEvent.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(BufferedChangeEvent);
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<BufferedChangeEvent>> BufferedChangeEvent::construct_impl(JS::Realm& realm, AK::FlyString const& type, BufferedChangeEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<BufferedChangeEvent>(realm, realm, type, event_init);
|
||||
}
|
||||
|
||||
BufferedChangeEvent::BufferedChangeEvent(JS::Realm& realm, AK::FlyString const& type, BufferedChangeEventInit const&)
|
||||
: DOM::Event(realm, type)
|
||||
{
|
||||
}
|
||||
|
||||
BufferedChangeEvent::~BufferedChangeEvent() = default;
|
||||
|
||||
void BufferedChangeEvent::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(BufferedChangeEvent);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/HTML/TimeRanges.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
struct BufferedChangeEventInit : public DOM::EventInit {
|
||||
JS::GCPtr<HTML::TimeRanges> added_ranges;
|
||||
JS::GCPtr<HTML::TimeRanges> removed_ranges;
|
||||
};
|
||||
|
||||
// https://w3c.github.io/media-source/#bufferedchangeevent-interface
|
||||
class BufferedChangeEvent : public DOM::Event {
|
||||
WEB_PLATFORM_OBJECT(BufferedChangeEvent, DOM::Event);
|
||||
JS_DECLARE_ALLOCATOR(BufferedChangeEvent);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static WebIDL::ExceptionOr<JS::NonnullGCPtr<BufferedChangeEvent>> construct_impl(JS::Realm&, FlyString const& type, BufferedChangeEventInit const& = {});
|
||||
|
||||
private:
|
||||
BufferedChangeEvent(JS::Realm&, FlyString const& type, BufferedChangeEventInit const& event_init);
|
||||
|
||||
virtual ~BufferedChangeEvent() override;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#import <DOM/Event.idl>
|
||||
#import <HTML/TimeRanges.idl>
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-bufferedchangeevent
|
||||
[Exposed=(Window,DedicatedWorker)]
|
||||
interface BufferedChangeEvent : Event {
|
||||
constructor(DOMString type, optional BufferedChangeEventInit eventInitDict = {});
|
||||
|
||||
[FIXME,SameObject] readonly attribute TimeRanges addedRanges;
|
||||
[FIXME,SameObject] readonly attribute TimeRanges removedRanges;
|
||||
};
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-bufferedchangeeventinit
|
||||
dictionary BufferedChangeEventInit : EventInit {
|
||||
TimeRanges addedRanges;
|
||||
TimeRanges removedRanges;
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/ManagedMediaSourcePrototype.h>
|
||||
#include <LibWeb/MediaSourceExtensions/ManagedMediaSource.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ManagedMediaSource);
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<ManagedMediaSource>> ManagedMediaSource::construct_impl(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<ManagedMediaSource>(realm, realm);
|
||||
}
|
||||
|
||||
ManagedMediaSource::ManagedMediaSource(JS::Realm& realm)
|
||||
: MediaSource(realm)
|
||||
{
|
||||
}
|
||||
|
||||
ManagedMediaSource::~ManagedMediaSource() = default;
|
||||
|
||||
void ManagedMediaSource::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(ManagedMediaSource);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/MediaSourceExtensions/MediaSource.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
// https://w3c.github.io/media-source/#managedmediasource-interface
|
||||
class ManagedMediaSource : public MediaSource {
|
||||
WEB_PLATFORM_OBJECT(ManagedMediaSource, MediaSource);
|
||||
JS_DECLARE_ALLOCATOR(ManagedMediaSource);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static WebIDL::ExceptionOr<JS::NonnullGCPtr<ManagedMediaSource>> construct_impl(JS::Realm&);
|
||||
|
||||
private:
|
||||
ManagedMediaSource(JS::Realm&);
|
||||
|
||||
virtual ~ManagedMediaSource() override;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#import <DOM/EventHandler.idl>
|
||||
#import <MediaSourceExtensions/MediaSource.idl>
|
||||
|
||||
// https://w3c.github.io/media-source/#managedmediasource-interface
|
||||
[Exposed=(Window,DedicatedWorker)]
|
||||
interface ManagedMediaSource : MediaSource {
|
||||
constructor();
|
||||
[FIXME] readonly attribute boolean streaming;
|
||||
[FIXME] attribute EventHandler onstartstreaming;
|
||||
[FIXME] attribute EventHandler onendstreaming;
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/ManagedSourceBufferPrototype.h>
|
||||
#include <LibWeb/MediaSourceExtensions/ManagedSourceBuffer.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ManagedSourceBuffer);
|
||||
|
||||
ManagedSourceBuffer::ManagedSourceBuffer(JS::Realm& realm)
|
||||
: SourceBuffer(realm)
|
||||
{
|
||||
}
|
||||
|
||||
ManagedSourceBuffer::~ManagedSourceBuffer() = default;
|
||||
|
||||
void ManagedSourceBuffer::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(ManagedSourceBuffer);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/MediaSourceExtensions/SourceBuffer.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
// https://w3c.github.io/media-source/#managedsourcebuffer-interface
|
||||
class ManagedSourceBuffer : public SourceBuffer {
|
||||
WEB_PLATFORM_OBJECT(ManagedSourceBuffer, SourceBuffer);
|
||||
JS_DECLARE_ALLOCATOR(ManagedSourceBuffer);
|
||||
|
||||
public:
|
||||
private:
|
||||
ManagedSourceBuffer(JS::Realm&);
|
||||
|
||||
virtual ~ManagedSourceBuffer() override;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
#import <DOM/EventHandler.idl>
|
||||
#import <MediaSourceExtensions/SourceBuffer.idl>
|
||||
|
||||
// https://w3c.github.io/media-source/#managedsourcebuffer-interface
|
||||
[Exposed=(Window,DedicatedWorker)]
|
||||
interface ManagedSourceBuffer : SourceBuffer {
|
||||
[FIXME] attribute EventHandler onbufferedchange;
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/MediaSourcePrototype.h>
|
||||
#include <LibWeb/MediaSourceExtensions/MediaSource.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(MediaSource);
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaSource>> MediaSource::construct_impl(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<MediaSource>(realm, realm);
|
||||
}
|
||||
|
||||
MediaSource::MediaSource(JS::Realm& realm)
|
||||
: DOM::EventTarget(realm)
|
||||
{
|
||||
}
|
||||
|
||||
MediaSource::~MediaSource() = default;
|
||||
|
||||
void MediaSource::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaSource);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-mediasource
|
||||
class MediaSource : public DOM::EventTarget {
|
||||
WEB_PLATFORM_OBJECT(MediaSource, DOM::EventTarget);
|
||||
JS_DECLARE_ALLOCATOR(MediaSource);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaSource>> construct_impl(JS::Realm&);
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-mediasource-canconstructindedicatedworker
|
||||
static bool can_construct_in_dedicated_worker(JS::VM&) { return true; }
|
||||
|
||||
protected:
|
||||
MediaSource(JS::Realm&);
|
||||
|
||||
virtual ~MediaSource() override;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#import <DOM/EventHandler.idl>
|
||||
#import <MediaSourceExtensions/MediaSourceHandle.idl>
|
||||
#import <MediaSourceExtensions/SourceBufferList.idl>
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-mediasource
|
||||
enum ReadyState {
|
||||
"closed",
|
||||
"open",
|
||||
"ended",
|
||||
};
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-mediasource
|
||||
enum EndOfStreamError {
|
||||
"network",
|
||||
"decode",
|
||||
};
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-mediasource
|
||||
[Exposed=(Window,DedicatedWorker)]
|
||||
interface MediaSource : EventTarget {
|
||||
constructor();
|
||||
|
||||
[FIXME, SameObject, Exposed=DedicatedWorker]
|
||||
readonly attribute MediaSourceHandle handle;
|
||||
[FIXME] readonly attribute SourceBufferList sourceBuffers;
|
||||
[FIXME] readonly attribute SourceBufferList activeSourceBuffers;
|
||||
[FIXME] readonly attribute ReadyState readyState;
|
||||
|
||||
[FIXME] attribute unrestricted double duration;
|
||||
[FIXME] attribute EventHandler onsourceopen;
|
||||
[FIXME] attribute EventHandler onsourceended;
|
||||
[FIXME] attribute EventHandler onsourceclose;
|
||||
|
||||
static readonly attribute boolean canConstructInDedicatedWorker;
|
||||
|
||||
[FIXME] SourceBuffer addSourceBuffer(DOMString type);
|
||||
[FIXME] undefined removeSourceBuffer(SourceBuffer sourceBuffer);
|
||||
[FIXME] undefined endOfStream(optional EndOfStreamError error);
|
||||
[FIXME] undefined setLiveSeekableRange(double start, double end);
|
||||
[FIXME] undefined clearLiveSeekableRange();
|
||||
[FIXME] static boolean isTypeSupported(DOMString type);
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/MediaSourceHandlePrototype.h>
|
||||
#include <LibWeb/MediaSourceExtensions/MediaSourceHandle.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(MediaSourceHandle);
|
||||
|
||||
MediaSourceHandle::MediaSourceHandle(JS::Realm& realm)
|
||||
: Bindings::PlatformObject(realm)
|
||||
{
|
||||
}
|
||||
|
||||
MediaSourceHandle::~MediaSourceHandle() = default;
|
||||
|
||||
void MediaSourceHandle::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaSourceHandle);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-mediasourcehandle
|
||||
class MediaSourceHandle : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(MediaSourceHandle, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(MediaSourceHandle);
|
||||
|
||||
public:
|
||||
private:
|
||||
MediaSourceHandle(JS::Realm&);
|
||||
|
||||
virtual ~MediaSourceHandle() override;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
// https://w3c.github.io/media-source/#dom-mediasourcehandle
|
||||
[Transferable, Exposed=(Window,DedicatedWorker)]
|
||||
interface MediaSourceHandle {};
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/SourceBufferPrototype.h>
|
||||
#include <LibWeb/MediaSourceExtensions/SourceBuffer.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SourceBuffer);
|
||||
|
||||
SourceBuffer::SourceBuffer(JS::Realm& realm)
|
||||
: DOM::EventTarget(realm)
|
||||
{
|
||||
}
|
||||
|
||||
SourceBuffer::~SourceBuffer() = default;
|
||||
|
||||
void SourceBuffer::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SourceBuffer);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-sourcebuffer
|
||||
class SourceBuffer : public DOM::EventTarget {
|
||||
WEB_PLATFORM_OBJECT(SourceBuffer, DOM::EventTarget);
|
||||
JS_DECLARE_ALLOCATOR(SourceBuffer);
|
||||
|
||||
protected:
|
||||
SourceBuffer(JS::Realm&);
|
||||
|
||||
virtual ~SourceBuffer() override;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
#import <DOM/EventHandler.idl>
|
||||
#import <HTML/AudioTrackList.idl>
|
||||
#import <HTML/TextTrackList.idl>
|
||||
#import <HTML/VideoTrackList.idl>
|
||||
#import <HTML/TimeRanges.idl>
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-sourcebuffer
|
||||
enum AppendMode {
|
||||
"segments",
|
||||
"sequence",
|
||||
};
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-sourcebuffer
|
||||
[Exposed=(Window,DedicatedWorker)]
|
||||
interface SourceBuffer : EventTarget {
|
||||
[FIXME] attribute AppendMode mode;
|
||||
[FIXME] readonly attribute boolean updating;
|
||||
[FIXME] readonly attribute TimeRanges buffered;
|
||||
[FIXME] attribute double timestampOffset;
|
||||
[FIXME] readonly attribute AudioTrackList audioTracks;
|
||||
[FIXME] readonly attribute VideoTrackList videoTracks;
|
||||
[FIXME] readonly attribute TextTrackList textTracks;
|
||||
[FIXME] attribute double appendWindowStart;
|
||||
[FIXME] attribute unrestricted double appendWindowEnd;
|
||||
|
||||
[FIXME] attribute EventHandler onupdatestart;
|
||||
[FIXME] attribute EventHandler onupdate;
|
||||
[FIXME] attribute EventHandler onupdateend;
|
||||
[FIXME] attribute EventHandler onerror;
|
||||
[FIXME] attribute EventHandler onabort;
|
||||
|
||||
[FIXME] undefined appendBuffer(BufferSource data);
|
||||
[FIXME] undefined abort();
|
||||
[FIXME] undefined changeType(DOMString type);
|
||||
[FIXME] undefined remove(double start, unrestricted double end);
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/SourceBufferListPrototype.h>
|
||||
#include <LibWeb/MediaSourceExtensions/SourceBufferList.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SourceBufferList);
|
||||
|
||||
SourceBufferList::SourceBufferList(JS::Realm& realm)
|
||||
: DOM::EventTarget(realm)
|
||||
{
|
||||
}
|
||||
|
||||
SourceBufferList::~SourceBufferList() = default;
|
||||
|
||||
void SourceBufferList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SourceBufferList);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
|
||||
namespace Web::MediaSourceExtensions {
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-sourcebufferlist
|
||||
class SourceBufferList : public DOM::EventTarget {
|
||||
WEB_PLATFORM_OBJECT(SourceBufferList, DOM::EventTarget);
|
||||
JS_DECLARE_ALLOCATOR(SourceBufferList);
|
||||
|
||||
private:
|
||||
SourceBufferList(JS::Realm&);
|
||||
|
||||
virtual ~SourceBufferList() override;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#import <DOM/EventHandler.idl>
|
||||
#import <MediaSourceExtensions/SourceBuffer.idl>
|
||||
|
||||
// https://w3c.github.io/media-source/#dom-sourcebufferlist
|
||||
[Exposed=(Window,DedicatedWorker)]
|
||||
interface SourceBufferList : EventTarget {
|
||||
[FIXME] readonly attribute unsigned long length;
|
||||
|
||||
[FIXME] attribute EventHandler onaddsourcebuffer;
|
||||
[FIXME] attribute EventHandler onremovesourcebuffer;
|
||||
|
||||
[FIXME] getter SourceBuffer (unsigned long index);
|
||||
};
|
|
@ -252,6 +252,13 @@ libweb_js_bindings(IntersectionObserver/IntersectionObserver)
|
|||
libweb_js_bindings(IntersectionObserver/IntersectionObserverEntry)
|
||||
libweb_js_bindings(MathML/MathMLElement)
|
||||
libweb_js_bindings(MediaCapabilitiesAPI/MediaCapabilities)
|
||||
libweb_js_bindings(MediaSourceExtensions/BufferedChangeEvent)
|
||||
libweb_js_bindings(MediaSourceExtensions/ManagedMediaSource)
|
||||
libweb_js_bindings(MediaSourceExtensions/ManagedSourceBuffer)
|
||||
libweb_js_bindings(MediaSourceExtensions/MediaSource)
|
||||
libweb_js_bindings(MediaSourceExtensions/MediaSourceHandle)
|
||||
libweb_js_bindings(MediaSourceExtensions/SourceBuffer)
|
||||
libweb_js_bindings(MediaSourceExtensions/SourceBufferList)
|
||||
libweb_js_bindings(NavigationTiming/PerformanceNavigation)
|
||||
libweb_js_bindings(NavigationTiming/PerformanceTiming)
|
||||
libweb_js_bindings(PerformanceTimeline/PerformanceEntry)
|
||||
|
|
Loading…
Add table
Reference in a new issue