Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: webkit/api/src/WebMediaPlayerClientImpl.cpp

Issue 199037: Buffered time ranges for <video> (Closed)
Patch Set: DEPS Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/api/src/WebMediaPlayerClientImpl.h ('k') | webkit/glue/webmediaplayer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/api/src/WebMediaPlayerClientImpl.cpp
diff --git a/webkit/api/src/WebMediaPlayerClientImpl.cpp b/webkit/api/src/WebMediaPlayerClientImpl.cpp
index a7c640447b59aba37a70a5c263db9b12d2bc6a09..b07ff6f86e4d18bf8d3368f040591d27cb33cefc 100644
--- a/webkit/api/src/WebMediaPlayerClientImpl.cpp
+++ b/webkit/api/src/WebMediaPlayerClientImpl.cpp
@@ -8,6 +8,7 @@
#if ENABLE(VIDEO)
#include "TemporaryGlue.h"
+#include "TimeRanges.h"
#include "WebCanvas.h"
#include "WebCString.h"
#include "WebKit.h"
@@ -253,11 +254,18 @@ float WebMediaPlayerClientImpl::maxTimeSeekable() const
return 0.0f;
}
-float WebMediaPlayerClientImpl::maxTimeBuffered() const
+WTF::PassRefPtr<WebCore::TimeRanges> WebMediaPlayerClientImpl::buffered() const
{
- if (m_webMediaPlayer.get())
- return m_webMediaPlayer->maxTimeBuffered();
- return 0.0f;
+ if (m_webMediaPlayer.get()) {
+ WebTimeRanges webRanges = m_webMediaPlayer->buffered();
+
+ // FIXME: Save the time ranges in a member variable and update it when needed.
+ WTF::RefPtr<TimeRanges> ranges = TimeRanges::create();
+ for (size_t i = 0; i < webRanges.size(); ++i)
+ ranges->add(webRanges[i].start, webRanges[i].end);
+ return ranges.release();
+ }
+ return TimeRanges::create();
}
int WebMediaPlayerClientImpl::dataRate() const
« no previous file with comments | « webkit/api/src/WebMediaPlayerClientImpl.h ('k') | webkit/glue/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698