Commit a9a8596e authored by Xiaowu Zhang's avatar Xiaowu Zhang

add jio excepted when getattachment with option _start, _end

parent 92d7f2c7
......@@ -184,11 +184,11 @@
});
}
}).declareMethod("startService", function() {
var g = this, command_context = g.__element.getElementsByClassName("command")[0], mute_context = g.__element.getElementsByClassName("mute")[0], bar_context = g.__element.getElementsByClassName("bar")[0], box_context = g.__element.getElementsByClassName("box")[0], filter_context = g.__element.getElementsByClassName("filter")[0], filter_type = $("select"), loop_context = g.__element.getElementsByClassName("loop")[0], loop = false, time_context = g.__element.getElementsByClassName("time")[0];
var g = this, blob, command_context = g.__element.getElementsByClassName("command")[0], mute_context = g.__element.getElementsByClassName("mute")[0], bar_context = g.__element.getElementsByClassName("bar")[0], box_context = g.__element.getElementsByClassName("box")[0], filter_context = g.__element.getElementsByClassName("filter")[0], filter_type = $("select"), loop_context = g.__element.getElementsByClassName("loop")[0], loop = false, time_context = g.__element.getElementsByClassName("time")[0];
bar_context.value = 0;
return new RSVP.Queue().push(function() {
set.call(g);
return RSVP.all([ g.plEnablePage(), g.plGive("loop"), g.plGive("mute") ]);
return RSVP.all([ g.plGive("loop"), g.plGive("mute") ]);
}).push(function(list) {
if (list[1]) {
loop = true;
......@@ -209,9 +209,12 @@
_attachment: "enclosure"
});
}
}).push(function(blob) {
}).push(function(result) {
blob = result;
return g.plEnablePage();
}).push(function() {
if (blob) {
g.audio.src = URL.createObjectURL(g.blob);
g.audio.src = URL.createObjectURL(blob);
g.audio.load();
g.audio.play();
}
......
......@@ -13,9 +13,19 @@
<script id="network" type="text/x-handlebars-template">
{{#each rows}}
<li>
<a href=#page=control&id={{this.id}}&action=localhost>
{{#compare this.doc.type}}
<a href=#page=control&id={{this.id}}&action=offline>
{{this.doc.title}}
</a>
{{else}}
<a href=#page=video_control&id={{this.id}}&action=offline>
{{this.doc.title}}
</a>
{{/compare}}
<a href=#page=playlist&id={{this.id}}&action=delete>
data-rel=popup
data-position-to=window
</a>
</li>
{{/each}}
</script>
......
......@@ -23,6 +23,12 @@
});
}).push(function(e) {
var tmp = e.data.rows, i, j, exp;
Handlebars.registerHelper("compare", function(v1, options) {
if (v1 === "audio/mp3" || v1 === "audio/mpeg") {
return options.fn(this);
}
return options.inverse(this);
});
if (options.id !== undefined && options.id !== "localhost") {
tmp = [];
for (i = 0, j = 0; i < e.data.rows.length; i += 1) {
......
......@@ -13,9 +13,19 @@
<script id="network" type="text/x-handlebars-template">
{{#each rows}}
<li>
<a href=#page=control&id={{this.id}}&action=online>
{{#compare this.doc.type}}
<a href=#page=control&id={{this.id}}&action=offline>
{{this.doc.title}}
</a>
{{else}}
<a href=#page=video_control&id={{this.id}}&action=offline>
{{this.doc.title}}
</a>
{{/compare}}
<a href=#page=playlist&id={{this.id}}&action=delete>
data-rel=popup
data-position-to=window
</a>
</li>
{{/each}}
</script>
......
......@@ -100,6 +100,12 @@
}).push(function(e) {
if (e.data) {
var tmp = e.data.rows, i, j, exp;
Handlebars.registerHelper("compare", function(v1, options) {
if (v1 === "audio/mp3" || v1 === "audio/mpeg") {
return options.fn(this);
}
return options.inverse(this);
});
if (options.id !== undefined && options.id !== "online") {
tmp = [];
for (i = 0, j = 0; i < e.data.rows.length; i += 1) {
......
......@@ -22,6 +22,7 @@
var share_context = g.__element.getElementsByClassName("share")[0];
share_context.href = "https://twitter.com/intent/tweet?hashtags=MusicPlayer&text=" + encodeURI(result.data.title);
g.size = result.data.size;
g.format = result.data.format;
return g.displayThisTitle(options.action + " : " + result.data.title);
}).push(function() {
return g.allDocs({
......@@ -72,23 +73,26 @@
});
}
}).declareMethod("startService", function() {
var g = this;
var g = this, blob;
return new RSVP.Queue().push(function() {
return g.plEnablePage();
}).push(function() {
if (g.rebuild) {
return g.jio_getAttachment({
_id: g.id,
_attachment: "enclosure"
});
}
}).push(function(blob) {
}).push(function(result) {
blob = result;
return g.plEnablePage();
}).push(function() {
if (blob) {
g.video.src = URL.createObjectURL(g.blob);
g.video.src = URL.createObjectURL(blob);
g.video.load();
g.video.play();
}
return RSVP.any([ loopEventListener(g.sourceBuffer, "updateend", false, function() {
return RSVP.any([ loopEventListener(g.video, "ended", false, function() {
window.location = g.__element.getElementsByClassName("next")[0].href;
}), loopEventListener(g.sourceBuffer, "updateend", false, function() {
if (!g.fin) {
return;
}
......
This diff is collapsed.
......@@ -252,6 +252,7 @@
})
.declareMethod("startService", function () {
var g = this,
blob,
command_context = g.__element.getElementsByClassName("command")[0],
mute_context = g.__element.getElementsByClassName("mute")[0],
bar_context = g.__element.getElementsByClassName("bar")[0],
......@@ -266,7 +267,6 @@
.push(function () {
set.call(g);
return RSVP.all([
g.plEnablePage(),
g.plGive("loop"),
g.plGive("mute")
]);
......@@ -290,9 +290,13 @@
"_attachment" : "enclosure"});
}
})
.push(function (blob) {
.push(function (result) {
blob = result;
return g.plEnablePage();
})
.push(function () {
if (blob) {
g.audio.src = URL.createObjectURL(g.blob);
g.audio.src = URL.createObjectURL(blob);
g.audio.load();
g.audio.play();
}
......
......@@ -13,9 +13,19 @@
<script id="network" type="text/x-handlebars-template">
{{#each rows}}
<li>
<a href=#page=control&id={{this.id}}&action=localhost>
{{#compare this.doc.type}}
<a href=#page=control&id={{this.id}}&action=offline>
{{this.doc.title}}
</a>
{{else}}
<a href=#page=video_control&id={{this.id}}&action=offline>
{{this.doc.title}}
</a>
{{/compare}}
<a href=#page=playlist&id={{this.id}}&action=delete>
data-rel=popup
data-position-to=window
</a>
</li>
{{/each}}
</script>
......
......@@ -40,6 +40,12 @@
i,
j,
exp;
Handlebars.registerHelper("compare", function (v1, options) {
if (v1 === "audio/mp3" || v1 === "audio/mpeg") {
return options.fn(this);
}
return options.inverse(this);
});
if (options.id !== undefined && options.id !== "localhost") {
tmp = [];
for (i = 0, j = 0; i < e.data.rows.length; i += 1) {
......
......@@ -13,9 +13,19 @@
<script id="network" type="text/x-handlebars-template">
{{#each rows}}
<li>
<a href=#page=control&id={{this.id}}&action=online>
{{#compare this.doc.type}}
<a href=#page=control&id={{this.id}}&action=offline>
{{this.doc.title}}
</a>
{{else}}
<a href=#page=video_control&id={{this.id}}&action=offline>
{{this.doc.title}}
</a>
{{/compare}}
<a href=#page=playlist&id={{this.id}}&action=delete>
data-rel=popup
data-position-to=window
</a>
</li>
{{/each}}
</script>
......
......@@ -139,6 +139,12 @@
i,
j,
exp;
Handlebars.registerHelper("compare", function (v1, options) {
if (v1 === "audio/mp3" || v1 === "audio/mpeg") {
return options.fn(this);
}
return options.inverse(this);
});
if (options.id !== undefined && options.id !== "online") {
tmp = [];
for (i = 0, j = 0; i < e.data.rows.length; i += 1) {
......
......@@ -41,6 +41,7 @@
"https://twitter.com/intent/tweet?hashtags=MusicPlayer&text="
+ encodeURI(result.data.title);
g.size = result.data.size;
g.format = result.data.format;
return g.displayThisTitle(options.action + " : "
+ result.data.title);
})
......@@ -104,24 +105,31 @@
}
})
.declareMethod("startService", function () {
var g = this;
var g = this,
blob;
return new RSVP.Queue()
.push(function () {
return g.plEnablePage();
})
.push(function () {
if (g.rebuild) {
return g.jio_getAttachment({"_id" : g.id,
"_attachment" : "enclosure"});
}
})
.push(function (blob) {
.push(function (result) {
blob = result;
return g.plEnablePage();
})
.push(function () {
if (blob) {
g.video.src = URL.createObjectURL(g.blob);
g.video.src = URL.createObjectURL(blob);
g.video.load();
g.video.play();
}
return RSVP.any([
loopEventListener(g.video, "ended", false, function () {
window.location = g.__element
.getElementsByClassName("next")[0].href;
}),
loopEventListener(g.sourceBuffer, "updateend", false, function () {
if (!g.fin) {
return;
......
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