LibWeb: Use Duration::to_seconds_f64 to set HTMLMediaElement duration
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

This commit is contained in:
Zaggy1024 2025-09-12 16:37:16 -05:00 committed by Gregory Bertilson
commit 261cd5846f
Notes: github-actions[bot] 2025-09-17 21:46:58 +00:00

View file

@ -1227,7 +1227,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void(Str
// named resize at the media element.
if (video_track && is<HTMLVideoElement>(*this)) {
auto duration = video_track ? video_track->duration() : audio_track->duration();
set_duration(static_cast<double>(duration.to_milliseconds()) / 1000.0);
set_duration(duration.to_seconds_f64());
auto& video_element = as<HTMLVideoElement>(*this);
video_element.set_video_width(video_track->pixel_width());
@ -1238,7 +1238,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void(Str
});
} else {
auto duration = audio_track ? audio_track->duration() : video_track->duration();
set_duration(static_cast<double>(duration.to_milliseconds()) / 1000.0);
set_duration(duration.to_seconds_f64());
}
// 6. Set the readyState attribute to HAVE_METADATA.