[Webkit-unassigned] [Bug 29041] HTMLMediaElement buffered attribute should report a list of time range

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 9 11:48:47 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=29041


Eric Carlson <eric.carlson at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #39233|review?                     |review+
               Flag|                            |




--- Comment #8 from Eric Carlson <eric.carlson at apple.com>  2009-09-09 11:48:47 PDT ---
(From update of attachment 39233)

@@ -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.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list