From 25dbbc7dfb6c4c64f6bc74743e15faefc40af0cf Mon Sep 17 00:00:00 2001 From: ldm0 Date: Thu, 1 Oct 2026 18:29:01 +0800 Subject: [PATCH] feat(media): expose media stream and video interface shells --- .../exposed_interfaces/metadata.rs | 16 +++- .../src/context_bootstrap/specs/registry.rs | 80 +++++++++++++++++++ moli-renderer-v8/src/web_api_interfaces.rs | 20 +++++ 3 files changed, 115 insertions(+), 1 deletion(-) diff --git a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs index 1643b18aac..e19bc4f746 100644 --- a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs +++ b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs @@ -37,6 +37,12 @@ pub(in crate::context_bootstrap) const WORKER_SHARED_INTERFACE_NAMES: &[&str] = "MIDIPort", "VideoDecoder", "VideoEncoder", + "ImageBitmapRenderingContext", + "MediaSourceHandle", + "SourceBuffer", + "SourceBufferList", + "VideoColorSpace", + "VideoFrame", "EventTarget", "Event", "CustomEvent", @@ -253,7 +259,15 @@ const WINDOW_DEDICATED_AND_SHARED_WORKER_INTERFACE_NAMES: &[&str] = &[ "XMLHttpRequest", ]; const DEDICATED_AND_SHARED_WORKER_INTERFACE_NAMES: &[&str] = &["FileReaderSync"]; -const WINDOW_AND_DEDICATED_WORKER_INTERFACE_NAMES: &[&str] = &["VideoDecoder", "VideoEncoder"]; +const WINDOW_AND_DEDICATED_WORKER_INTERFACE_NAMES: &[&str] = &[ + "VideoDecoder", + "VideoEncoder", + "MediaSourceHandle", + "SourceBuffer", + "SourceBufferList", + "VideoColorSpace", + "VideoFrame", +]; pub(in crate::context_bootstrap) const INDEXED_DB_INTERFACE_NAMES: &[&str] = &[ "DOMStringList", diff --git a/moli-renderer-v8/src/context_bootstrap/specs/registry.rs b/moli-renderer-v8/src/context_bootstrap/specs/registry.rs index 33ee2ded43..31aaa484ae 100644 --- a/moli-renderer-v8/src/context_bootstrap/specs/registry.rs +++ b/moli-renderer-v8/src/context_bootstrap/specs/registry.rs @@ -136,6 +136,86 @@ const CONSTRUCTOR_SPECS_BEFORE_STREAMS: &[ConstructorSpec] = &[ interface: web_api_interfaces::CSSTransition::DESCRIPTOR, kind: ConstructorKind::Illegal, }, + ConstructorSpec { + interface: web_api_interfaces::CanvasCaptureMediaStreamTrack::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::ImageBitmapRenderingContext::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::MediaEncryptedEvent::DESCRIPTOR, + kind: ConstructorKind::Shell { length: 1 }, + }, + ConstructorSpec { + interface: web_api_interfaces::MediaMetadata::DESCRIPTOR, + kind: ConstructorKind::Shell { length: 0 }, + }, + ConstructorSpec { + interface: web_api_interfaces::MediaRecorder::DESCRIPTOR, + kind: ConstructorKind::Shell { length: 1 }, + }, + ConstructorSpec { + interface: web_api_interfaces::MediaSession::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::MediaSourceHandle::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::MediaStream::DESCRIPTOR, + kind: ConstructorKind::Shell { length: 0 }, + }, + ConstructorSpec { + interface: web_api_interfaces::MediaStreamTrack::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::MediaStreamTrackEvent::DESCRIPTOR, + kind: ConstructorKind::Shell { length: 2 }, + }, + ConstructorSpec { + interface: web_api_interfaces::OverconstrainedError::DESCRIPTOR, + kind: ConstructorKind::Shell { length: 1 }, + }, + ConstructorSpec { + interface: web_api_interfaces::PictureInPictureEvent::DESCRIPTOR, + kind: ConstructorKind::Shell { length: 2 }, + }, + ConstructorSpec { + interface: web_api_interfaces::PictureInPictureWindow::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::RemotePlayback::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::SourceBuffer::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::SourceBufferList::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::TimeRanges::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, + ConstructorSpec { + interface: web_api_interfaces::VideoColorSpace::DESCRIPTOR, + kind: ConstructorKind::Shell { length: 0 }, + }, + ConstructorSpec { + interface: web_api_interfaces::VideoFrame::DESCRIPTOR, + kind: ConstructorKind::Shell { length: 1 }, + }, + ConstructorSpec { + interface: web_api_interfaces::VideoPlaybackQuality::DESCRIPTOR, + kind: ConstructorKind::Illegal, + }, ConstructorSpec { interface: web_api_interfaces::External::DESCRIPTOR, kind: ConstructorKind::Illegal, diff --git a/moli-renderer-v8/src/web_api_interfaces.rs b/moli-renderer-v8/src/web_api_interfaces.rs index 2b53cd3508..3ccf9c8c69 100644 --- a/moli-renderer-v8/src/web_api_interfaces.rs +++ b/moli-renderer-v8/src/web_api_interfaces.rs @@ -49,6 +49,26 @@ interfaces! { VideoEncoder: EventTarget; CSSAnimation: Animation; CSSTransition: Animation; + CanvasCaptureMediaStreamTrack: MediaStreamTrack; + ImageBitmapRenderingContext; + MediaEncryptedEvent: Event; + MediaMetadata; + MediaRecorder: EventTarget; + MediaSession; + MediaSourceHandle; + MediaStream: EventTarget; + MediaStreamTrack: EventTarget; + MediaStreamTrackEvent: Event; + OverconstrainedError: DOMException; + PictureInPictureEvent: Event; + PictureInPictureWindow: EventTarget; + RemotePlayback: EventTarget; + SourceBuffer: EventTarget; + SourceBufferList: EventTarget; + TimeRanges; + VideoColorSpace; + VideoFrame; + VideoPlaybackQuality; AbortController; AbortSignal: EventTarget; AbstractRange;