Skip to content

Commit

Permalink
Force a dummy sound at startup on iOS to initialize audio
Browse files Browse the repository at this point in the history
  • Loading branch information
llaske committed Mar 21, 2020
1 parent f198b27 commit e6b8b2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Binary file added audio/silence.mp3
Binary file not shown.
9 changes: 9 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ define(["webL10n", "sugar-web/graphics/icon", "sugar-web/graphics/xocolor", "sug
}
}, false);

// HACK: on iOS, create a media to initialize sound
if (enyo.platform.ios && document.location.protocol.substr(0,4) != "http") {
document.addEventListener("deviceready", function() {
var release = function() { media.release(); }
var media = new Media("audio/silence.mp3", release, release, release);
media.play();
});
}

// Wait for DOM is ready.
requirejs(['domReady!'], function (doc) {
if (--toload == 0) {
Expand Down

0 comments on commit e6b8b2f

Please sign in to comment.