add uploadVideo, encode video and upload to given url using Firefogg Chunk upload api
This commit is contained in:
parent
166268a30c
commit
dd86adb0c2
6 changed files with 183 additions and 42 deletions
|
|
@ -67,8 +67,6 @@ var _ids = new Array();
|
|||
|
||||
var ox = new OxFF();
|
||||
ox.access(true);
|
||||
ox.login('username');
|
||||
|
||||
//ox.get('b2c8f0aa3a447d09', 'stills', function(result) { console.log(result);});
|
||||
//ox.files(function(result) { console.log(result);});
|
||||
|
||||
|
|
@ -104,7 +102,38 @@ function for_each_sorted(elements, callback) {
|
|||
});
|
||||
}
|
||||
|
||||
function extract(oshash) {
|
||||
console.log(oshash);
|
||||
/*
|
||||
ox.extract(oshash, 'stills', function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
*/
|
||||
profile = '96p.webm';
|
||||
var url = 'http://127.0.0.1:8000/api/upload/?profile='+profile+'&oshash='+oshash;
|
||||
|
||||
$('<div>').attr('id', 'progress_'+oshash)
|
||||
.appendTo('#' + oshash);
|
||||
ox.uploadVideo(oshash, url, profile, function(result) {
|
||||
console.log(result);
|
||||
$('#' + oshash).css('background', '#fff');
|
||||
$('#' + oshash).parent().css('background', '#fff');
|
||||
$('#progress_'+oshash).remove();
|
||||
}, function(result) {
|
||||
try {
|
||||
var data = JSON.parse(result);
|
||||
$('#progress_'+oshash).html(data.status +': '+ data.progress);
|
||||
} catch(e) {
|
||||
console.log('progress failed', e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function update() {
|
||||
var username = $('#username').val();
|
||||
var password = $('#password').val();
|
||||
ox.login(username);
|
||||
pandora.request('login', {'username': username, 'password': password});
|
||||
var updating = true;
|
||||
ox.update(function(result) {
|
||||
updating = false;
|
||||
|
|
@ -119,6 +148,13 @@ function update() {
|
|||
var post = {'info': {}};
|
||||
function highlight_resulsts(result) {
|
||||
$.each(result.data.data, function(i, oshash) {
|
||||
if($('#' + oshash).css('background') != 'red') {
|
||||
$('#' + oshash).unbind('click').click(function() {
|
||||
$(this).unbind('click');
|
||||
extract(this.id);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
$('#' + oshash).css('background', 'red');
|
||||
$('#' + oshash).parent().css('background', 'orange');
|
||||
});
|
||||
|
|
@ -200,6 +236,9 @@ function setLocation(name) {
|
|||
</script>
|
||||
</head>
|
||||
<body>
|
||||
Username: <input type="text" id="username" value="">
|
||||
Password: <input type="password" id="password" value="">
|
||||
<br>
|
||||
<input type="button" onClick="setLocation('test')" value="Set Location">
|
||||
<input type="button" onClick="update()" value="Update">
|
||||
<div id="files">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue