Skip to content

Commit d997651

Browse files
committed
LibWeb: Update the duration of an element based on media data
1 parent d4e6284 commit d997651

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Libraries/LibWeb/HTML/HTMLMediaElement.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,11 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void(Str
12221222
weak_self->on_playback_manager_state_change();
12231223
};
12241224

1225+
m_playback_manager->on_duration_change = [weak_self = GC::Weak(*this)](AK::Duration duration) {
1226+
if (weak_self)
1227+
weak_self->set_duration(duration.to_seconds_f64());
1228+
};
1229+
12251230
update_volume();
12261231

12271232
// -> If the media resource is found to have an audio track

0 commit comments

Comments
 (0)