[webkit-reviews] review granted: [Bug 29041] HTMLMediaElement buffered attribute should report a list of time range : [Attachment 39233] patch to be submitted
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Sep 9 11:48:46 PDT 2009
Eric Carlson <eric.carlson at apple.com> has granted Hin-Chung Lam
<hclam at google.com>'s request for review:
Bug 29041: HTMLMediaElement buffered attribute should report a list of time
range
https://bugs.webkit.org/show_bug.cgi?id=29041
Attachment 39233: patch to be submitted
https://bugs.webkit.org/attachment.cgi?id=39233&action=review
------- Additional Comments from Eric Carlson <eric.carlson at apple.com>
@@ -1287,7 +1287,15 @@ float HTMLMediaElement::percentLoaded() const
if (!m_player)
return 0;
float duration = m_player->duration();
- return duration ? m_player->maxTimeBuffered() / duration : 0;
+ float buffered = 0;
+ RefPtr<TimeRanges> timeRanges = m_player->buffered();
+ for (unsigned i = 0; i < timeRanges->length(); ++i) {
+ ExceptionCode ignoredException;
+ float start = timeRanges->start(i, ignoredException);
+ float end = timeRanges->end(i, ignoredException);
+ buffered += end - start;
+ }
+ return duration ? buffered / duration : 0;
Why accumulate the buffered ranges if duration is zero or infinite? Should
probably just have an early return instead.
r=me with this change, no need to re-submit for review.
More information about the webkit-reviews
mailing list