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

Unified Diff: content/browser/resources/media/new/graph_painter.js

Issue 18889006: Removed old media-internals page and rewrote it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved all 'new' media internals files into its own folder for a smooth transition. Created 7 years, 5 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 | « content/browser/resources/media/new/goog.js ('k') | content/browser/resources/media/new/hover.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/resources/media/new/graph_painter.js
diff --git a/content/browser/resources/media/new/graph_painter.js b/content/browser/resources/media/new/graph_painter.js
new file mode 100644
index 0000000000000000000000000000000000000000..b1c61b0e74c746358237a9f3ace1950148864f75
--- /dev/null
+++ b/content/browser/resources/media/new/graph_painter.js
@@ -0,0 +1,55 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+var graphPainter = (function () {
+ "use strict";
+ var graphPainter = {};
+
+ function updateBufferGraph(playerInfo, bufferGraph) {
+ bufferGraph.setWidth(400);
+
+ var p = playerInfo.properties;
+
+ bufferGraph.plot(p.buffer_start, p.buffer_end);
+ bufferGraph.plot(p.buffer_start, p.buffer_current);
+ bufferGraph.draw();
+ }
+
+ graphPainter.paintNew = function (playerInfo, div, options) {
+ removeChildren(div);
+
+ var p = playerInfo.properties;
+
+ // If we can, make a new graph for the buffer status
+ if (p.buffer_start !== undefined && p.buffer_current !== undefined &&
+ p.buffer_end !== undefined && p.total_bytes !== undefined) {
+
+ var bufferGraph = new RangeGraph(p.total_bytes);
+ updateBufferGraph(playerInfo, bufferGraph);
+ bufferGraph.element.setAttribute('id', "buffer-graph");
+ bufferGraph.element.setAttribute('style', "vertical-align:middle;");
+
+
+ div.appendChild(document.createTextNode("Buffer\u00a0"));
+ div.appendChild(bufferGraph.element);
+ }
+
+ };
+ graphPainter.paintExist = function (playerInfo, div, options) {
+ var bufferGraphElem = div.querySelector("#buffer-graph");
+
+ if (bufferGraphElem) {
+ // Use the 'existing' constructor for RangeGraph to
+ // build it off of the existing bufferGraphElem
+ var bufferGraph = new RangeGraph(playerInfo.properties.total_bytes,
+ bufferGraphElem);
+ updateBufferGraph(playerInfo, bufferGraph);
+ }
+ };
+ graphPainter.invalidate = function () {
+ };
+
+ return graphPainter;
+}());
« no previous file with comments | « content/browser/resources/media/new/goog.js ('k') | content/browser/resources/media/new/hover.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698