//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('