summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Dabrowski <p.dabrowski2@samsung.com>2013-07-15 14:36:47 +0200
committerPiotr Dabrowski <p.dabrowski2@samsung.com>2013-07-15 14:36:47 +0200
commit154aaac5a6f97f37a2e8af96650824a44e1b71d9 (patch)
treeb74c7b6f312ddde6321d28b9d50ec95e1a03d135
parentb320be13683ba74e2be834b91d5d53df575d8b98 (diff)
downloadPiano-154aaac5a6f97f37a2e8af96650824a44e1b71d9.tar.gz
Piano-154aaac5a6f97f37a2e8af96650824a44e1b71d9.tar.bz2
Piano-154aaac5a6f97f37a2e8af96650824a44e1b71d9.zip
[Piano] updated Piano sources2.2_release
Change-Id: I78648f109ae5f9af36f2b3692ee3d3f794c81b3f
-rw-r--r--js/main.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/js/main.js b/js/main.js
index fbbec59..986eb8a 100644
--- a/js/main.js
+++ b/js/main.js
@@ -52,6 +52,12 @@ function Piano() {
$('#back').bind('touchend', function (event) {
$(this).removeClass('active');
});
+
+ document.addEventListener('webkitvisibilitychange', function () {
+ if (document.webkitVisibilityState === 'visible') {
+ self.audioInit()
+ }
+ })
};
Piano.prototype.onPianoKeyTouchDown = function onPianoKeyTouchDown(data) {
@@ -107,8 +113,12 @@ function Piano() {
this.touchPianoKey[touchId] = element.id;
if (this.audio[nrAudio]) {
if (this.audio[nrAudio].src) {
- this.audio[nrAudio].pause();
- this.audio[nrAudio].currentTime = 0;
+ try {
+ this.audio[nrAudio].pause();
+ this.audio[nrAudio].currentTime = 0;
+ } catch (err) {
+ console.error(err);
+ }
} else {
this.audio[nrAudio].src = this.audio[nrAudio].name + ".wav";
}