From 47b751c9d92535888a121aeee5a08f5c065d48df Mon Sep 17 00:00:00 2001 From: Jeremy Tan Date: Fri, 1 Nov 2013 06:56:45 +0800 Subject: [PATCH] Attempt to get image streaming page back from the dead (untested). --- testing/MCTXWeb/public_html/image.html | 91 +++++++++++++++++++ .../MCTXWeb/public_html/static/mctx.gui.js | 34 +++++++ 2 files changed, 125 insertions(+) create mode 100644 testing/MCTXWeb/public_html/image.html diff --git a/testing/MCTXWeb/public_html/image.html b/testing/MCTXWeb/public_html/image.html new file mode 100644 index 0000000..3148602 --- /dev/null +++ b/testing/MCTXWeb/public_html/image.html @@ -0,0 +1,91 @@ + + + + MCTX3420 Web Interface + + + + + + + + + + + + + +
+ +
+ + +
+ + +
+ + + + +
+
+
Image
+ camera +
+
+ +
+
+ + diff --git a/testing/MCTXWeb/public_html/static/mctx.gui.js b/testing/MCTXWeb/public_html/static/mctx.gui.js index 13ca08e..1c3eb1f 100644 --- a/testing/MCTXWeb/public_html/static/mctx.gui.js +++ b/testing/MCTXWeb/public_html/static/mctx.gui.js @@ -227,6 +227,40 @@ $.fn.logout = function () { }); }; +/** +* Sets the camera autoupdater +* Obsolete? +* @returns {$.fn} +*/ +$.fn.setCamera = function () { + var url = mctx.api + "image"; //http://beaglebone/api/image + var update = true; + + //Stop updating if we can't retrieve an image! + this.error(function() { + update = false; + }); + + var parent = this; + + var updater = function() { + if (!update) { + parent.parent().text("Cam fail"); + parent.attr("src", ""); + return; + } + + parent.attr("src", url + "#" + (new Date()).getTime()); + + setTimeout(updater, 2000); + }; + + updater(); + return this; +}; + + + /** * Sets the error log to continuously update. * @returns itself */ -- 2.20.1