Commit 8d1e93b5 authored by Xiaowu Zhang's avatar Xiaowu Zhang

add volume control in control gadget

parent a1c0707c
......@@ -22,22 +22,9 @@
.declareMethod('playSong', function () {
this.audio.play();
})
.declareMethod('volumeUp', function () {
var gadget = this;
if (gadget.volume < 3) {
gadget.volume += 0.2;
}
gadget.gain.gain.value = gadget.volume;
})
.declareMethod('volumeDowm', function () {
var gadget = this;
if (gadget.volume > 0) {
gadget.volume -= 0.2;
if (gadget.volume < 0) {
gadget.volume = 0;
}
}
gadget.gain.gain.value = gadget.volume;
.declareMethod('setVolume', function (volume) {
this.volume = volume;
this.gain.gain.value = volume;
})
.declareMethod('getVolume', function () {
return Math.round(this.volume * 100) + "%";
......@@ -90,7 +77,7 @@
gadget.buffer = buffer;
resolve(buffer);
}, function () {
reject(-1);
reject("decode error");
});
});
}).then(function (response) {
......
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