Skip to content

Commit

Permalink
Fix sound not play on Memorize activity in iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
llaske committed Jul 21, 2019
1 parent 6dbc51a commit 5053f84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Camera doesn't work on Record/QRCode activities for Snapcraft version #351
- Add a pause button to the Physics activity #354
- Context is lost the second time in Abecedarium activity #359
- Sound not play on Memorize activity in iOS


## [1.1.0] - 2019-01-20
Expand Down
28 changes: 7 additions & 21 deletions activities/Memorize.activity/js/memorize-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,32 +491,18 @@ define(["activity/sample-ressources", "activity/palettes/template-palette", "act
MemorizeApp.context.decodeAudioData(b64, function (buffer) {
var source = MemorizeApp.context.createBufferSource(); // creates a sound source
if (MemorizeApp.source) {
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
try {
MemorizeApp.source.noteOff(0);
} catch (e) {
}
} else {
try {
MemorizeApp.source.stop(0);
} catch (e) {
}
try {
MemorizeApp.source.stop(0);
} catch (e) {
}
}
MemorizeApp.source = source;
source.buffer = buffer;
source.connect(MemorizeApp.context.destination);
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
try {
source.noteOn(0);
} catch (e) {
}
} else {
try {
source.start(0);
} catch (e) {
try {
source.start(0);
} catch (e) {

}
}
}, function (err) {
console.log("err(decodeAudioData): " + err);
Expand Down Expand Up @@ -658,7 +644,7 @@ define(["activity/sample-ressources", "activity/palettes/template-palette", "act

var clickEvent = "click";
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
clickEvent = "touchstart";
clickEvent = "touchend";
}
fullCardDiv.addEventListener(clickEvent, onCardClick, false);
fullCardDiv.appendChild(div);
Expand Down

0 comments on commit 5053f84

Please sign in to comment.