Skip to content

Commit

Permalink
MPEG: iOS audio timing is better with audio context
Browse files Browse the repository at this point in the history
  • Loading branch information
codefrau committed Dec 16, 2023
1 parent 1c597b5 commit 37e535e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@
PloppVideo.play();
// also play a silent audio to allow audio on iOS
PloppAudio = new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA");
// for some reason, timing is more accurate on iOS
// if we play through an audio context
var audioCtx = Squeak.startAudioOut();
var node = audioCtx.createMediaElementSource(PloppAudio);
node.connect(audioCtx.destination);
PloppAudio.play();
// disable fsck (has trouble with templates)
// disable fsck (has trouble with templates)
Squeak.fsck = function() {};
// pretend to be unix
Squeak.platformName = "unix";
Expand Down

0 comments on commit 37e535e

Please sign in to comment.