1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 15:35:07 +00:00

LibWeb: Dispatch an addtrack event for newly created audio tracks

This commit is contained in:
Timothy Flynn 2023-06-13 10:58:49 -04:00 committed by Andreas Kling
parent 6520a9a849
commit 0c4b28faf3

View file

@ -990,7 +990,12 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void(Str
if (enable == TriState::True)
audio_track->set_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