mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:35:07 +00:00
LibWeb: Report HTMLMediaElement duration with sub-second accuracy
We currently use Time::to_seconds() to report a video's duration. The video, however, may have a sub-second duration. For example, the video used by the video test page is 12.05 seconds long.
This commit is contained in:
parent
2ef4a51c39
commit
6b51c3c1ce
1 changed files with 2 additions and 1 deletions
|
@ -676,7 +676,8 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void()>
|
||||||
// 4. Update the duration attribute with the time of the last frame of the resource, if known, on the media timeline established above. If it is
|
// 4. Update the duration attribute with the time of the last frame of the resource, if known, on the media timeline established above. If it is
|
||||||
// not known (e.g. a stream that is in principle infinite), update the duration attribute to the value positive Infinity.
|
// not known (e.g. a stream that is in principle infinite), update the duration attribute to the value positive Infinity.
|
||||||
// FIXME: Handle unbounded media resources.
|
// FIXME: Handle unbounded media resources.
|
||||||
set_duration(static_cast<double>(video_track->duration().to_seconds()));
|
auto duration = static_cast<double>(video_track->duration().to_milliseconds());
|
||||||
|
set_duration(duration / 1000.0);
|
||||||
|
|
||||||
// 5. For video elements, set the videoWidth and videoHeight attributes, and queue a media element task given the media element to fire an event
|
// 5. For video elements, set the videoWidth and videoHeight attributes, and queue a media element task given the media element to fire an event
|
||||||
// named resize at the media element.
|
// named resize at the media element.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue