From 97ac8b6912d39c6d9016a1443b16aa09a1260051 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 30 Jul 2010 15:27:51 +0200 Subject: [PATCH] add test --- media/test.html | 12 ++++++ media/test.js | 105 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 media/test.html create mode 100644 media/test.js diff --git a/media/test.html b/media/test.html new file mode 100644 index 0000000..5dcd978 --- /dev/null +++ b/media/test.html @@ -0,0 +1,12 @@ + + + + + + + + +
+
+ + diff --git a/media/test.js b/media/test.js new file mode 100644 index 0000000..bee0597 --- /dev/null +++ b/media/test.js @@ -0,0 +1,105 @@ +//http://127.0.0.1:2620/media/test.html +$(function(){ + backend= { + base:'/', + profile: '96p.webm', + request: function(func, data, callback) { + $.getJSON(this.base+func, data, callback); + }, + extractStills: function(oshash, callback) { + this.request('extract', {'oshash': oshash, 'media': 'stills'}, callback); + }, + extractVideo: function(oshash, callback) { + this.request('extract', {'oshash': oshash, 'media': this.profile}, callback); + }, + info: function(oshash, callback) { + this.request('get', {'oshash': oshash}, callback); + }, + }; + + function addStill(parent, oshash) { + backend.request('get', {'oshash':oshash}, function(result) { + //console.log(result); + if(result.stills.length>0) { + $(parent).append(''); + } else { + backend.request('extract', {'oshash':oshash, 'media': 'stills'}, function(result) { + setTimeout(function () { + addStill(parent, oshash); + }, 25000); + }); + } + }); + } + function addVideo(parent, oshash) { + backend.request('get', {'oshash':oshash}, function(result) { + console.log(result); + if(result.video.length>0) { + $(parent).append('