Commit b366064f authored by Xiaowu Zhang's avatar Xiaowu Zhang

cancel time out job

parent ff3a4b69
...@@ -141,7 +141,8 @@ ...@@ -141,7 +141,8 @@
}).push(function(gadget) { }).push(function(gadget) {
return gadget.createJio({ return gadget.createJio({
type: "indexeddb", type: "indexeddb",
database: "test" database: "test",
_unite: 5e6
}); });
}).push(function() { }).push(function() {
var controlPanel = g.__element.getElementsByClassName("page")[0]; var controlPanel = g.__element.getElementsByClassName("page")[0];
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
function tmp() { function tmp() {
callback_promise = new RSVP.Queue().push(function() { callback_promise = new RSVP.Queue().push(function() {
callback(); callback();
animationId = window.requestAnimationFrame(tmp); return promiseRequestAnimation(callback);
}).push(undefined, function(error) { }).push(undefined, function(error) {
canceller(); canceller();
reject(error); reject(error);
...@@ -160,17 +160,20 @@ ...@@ -160,17 +160,20 @@
g.size = result.data.size; g.size = result.data.size;
return g.displayThisTitle(options.action + " : " + result.data.title); return g.displayThisTitle(options.action + " : " + result.data.title);
}).push(function() { }).push(function() {
g.index = 1e6; g.index = 2e6;
return g.jio_getAttachment({ return g.jio_getAttachment({
_id: options.id, _id: options.id,
_attachment: "enclosure", _attachment: "enclosure",
_start: 0, _start: 0,
_end: 1e6 _end: 2e6
}); });
}).push(function(blob) { }).push(function(blob) {
g.sourceBuffer = g.mediaSource.addSourceBuffer("audio/mpeg;"); g.sourceBuffer = g.mediaSource.addSourceBuffer("audio/mpeg;");
return jIO.util.readBlobAsArrayBuffer(blob).then(function(e) { return jIO.util.readBlobAsArrayBuffer(blob).then(function(e) {
g.sourceBuffer.appendBuffer(new Uint8Array(e.target.result)); g.sourceBuffer.appendBuffer(new Uint8Array(e.target.result));
if (g.index >= g.size) {
g.mediaSource.endOfStream();
}
g.audio.play(); g.audio.play();
g.fin = true; g.fin = true;
}); });
......
...@@ -1820,7 +1820,7 @@ function JIO(storage_spec, options) { ...@@ -1820,7 +1820,7 @@ function JIO(storage_spec, options) {
enableJobMaker(this, shared, options); enableJobMaker(this, shared, options);
enableJobReference(this, shared, options); enableJobReference(this, shared, options);
enableJobRetry(this, shared, options); enableJobRetry(this, shared, options);
enableJobTimeout(this, shared, options); // enableJobTimeout(this, shared, options);
enableJobChecker(this, shared, options); enableJobChecker(this, shared, options);
enableJobQueue(this, shared, options); enableJobQueue(this, shared, options);
enableJobRecovery(this, shared, options); enableJobRecovery(this, shared, options);
......
...@@ -168,7 +168,8 @@ ...@@ -168,7 +168,8 @@
.push(function (gadget) { .push(function (gadget) {
return gadget.createJio( return gadget.createJio(
{ "type" : "indexeddb", { "type" : "indexeddb",
"database" : "test"} "database" : "test",
"_unite" : 5000000}
); );
}) })
.push(function () { .push(function () {
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
callback_promise = new RSVP.Queue() callback_promise = new RSVP.Queue()
.push(function () { .push(function () {
callback(); callback();
animationId = window.requestAnimationFrame(tmp); return promiseRequestAnimation(callback);
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
canceller(); canceller();
...@@ -223,16 +223,19 @@ ...@@ -223,16 +223,19 @@
+ result.data.title); + result.data.title);
}) })
.push(function () { .push(function () {
g.index = 1000000; g.index = 2000000;
return g.jio_getAttachment({"_id" : options.id, return g.jio_getAttachment({"_id" : options.id,
"_attachment" : "enclosure", "_attachment" : "enclosure",
"_start": 0, "_start": 0,
"_end": 1000000}); "_end": 2000000});
}) })
.push(function (blob) { .push(function (blob) {
g.sourceBuffer = g.mediaSource.addSourceBuffer('audio/mpeg;'); g.sourceBuffer = g.mediaSource.addSourceBuffer('audio/mpeg;');
return jIO.util.readBlobAsArrayBuffer(blob).then(function (e) { return jIO.util.readBlobAsArrayBuffer(blob).then(function (e) {
g.sourceBuffer.appendBuffer(new Uint8Array(e.target.result)); g.sourceBuffer.appendBuffer(new Uint8Array(e.target.result));
if (g.index >= g.size) {
g.mediaSource.endOfStream();
}
g.audio.play(); g.audio.play();
g.fin = true; g.fin = true;
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment