From 0c4b28faf3ed811d9166ef764c0f1659859d9290 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 13 Jun 2023 10:58:49 -0400 Subject: [PATCH] LibWeb: Dispatch an addtrack event for newly created audio tracks --- Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index b132e15330..2e9e5b3534 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -990,7 +990,12 @@ WebIDL::ExceptionOr HTMLMediaElement::process_media_data(Functionset_enabled(true); - // FIXME: 7. Fire an event named addtrack at this AudioTrackList object, using TrackEvent, with the track attribute initialized to the new AudioTrack object. + // 7. Fire an event named addtrack at this AudioTrackList object, using TrackEvent, with the track attribute initialized to the new AudioTrack object. + TrackEventInit event_init {}; + event_init.track = JS::make_handle(audio_track); + + auto event = TRY(TrackEvent::create(realm, HTML::EventNames::addtrack, move(event_init))); + m_audio_tracks->dispatch_event(event); } // -> If the media resource is found to have a video track