diff options
author | Piotr Dabrowski <p.dabrowski2@samsung.com> | 2013-07-15 14:36:47 +0200 |
---|---|---|
committer | Piotr Dabrowski <p.dabrowski2@samsung.com> | 2013-07-15 14:36:47 +0200 |
commit | 154aaac5a6f97f37a2e8af96650824a44e1b71d9 (patch) | |
tree | b74c7b6f312ddde6321d28b9d50ec95e1a03d135 | |
parent | b320be13683ba74e2be834b91d5d53df575d8b98 (diff) | |
download | Piano-154aaac5a6f97f37a2e8af96650824a44e1b71d9.tar.gz Piano-154aaac5a6f97f37a2e8af96650824a44e1b71d9.tar.bz2 Piano-154aaac5a6f97f37a2e8af96650824a44e1b71d9.zip |
[Piano] updated Piano sources2.2_release
Change-Id: I78648f109ae5f9af36f2b3692ee3d3f794c81b3f
-rw-r--r-- | js/main.js | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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"; } |