2

I've stripped the problem right down to a few lines to isolate it. You can see it at http://radiorice.com/mobile/broken.html

The audio file is available in aac and ogg formats. It plays fine in mobile Safari when loaded inside an <audio> element. But when I try to register it in SoundJS, Safari crashes with the "A problem occurred with this webpage..." message.

The page works fine in desktop Safari, in Chrome and even in the version of mobile Safari I have running on an iPhone 4s in iOS simulator. There are no problems reported in the console for the simulator.

Because the crash is always about 10s after the page loads I wondered if it was a problem relating to the mobile Safari 10s time limit and tried putting the registerSound call in a timeout() function with a 10s delay. That simply delayed the crash by 10s.

I don't think this is a memory problem because the audio file can be loaded and played quite happily inside the <audio> tag.

<html>
<!DOCTYPE html>
<head>        
<script src="https://code.createjs.com/soundjs-0.6.0.min.js"></script>
    <script>
        var sounds =[
            {id:"Sleep_Talk_Recorder", src:"Sleep_Talk_Recorder.m4a"}
        ];
        createjs.Sound.initializeDefaultPlugins();
        createjs.Sound.alternateExtensions = ["ogg"];
        createjs.Sound.on("fileload", handleLoad); // call handleLoad when each sound loads
        createjs.Sound.registerSounds(sounds, "../content/sounds/small/");

        function handleLoad(event) {
        console.log("Preloaded:", event.id, event.src);
        }
    </script>
</head>
<body>
    <p>Audio file plays fine:</p>
    <audio controls>
    <source src="../content/sounds/small/Sleep_Talk_Recorder.m4a" type="audio/aac">
    <source src="../content/sounds/small/Sleep_Talk_Recorder.ogg" type="audio/ogg">
    Your browser does not support the audio element.
    </audio>
</body>
</html>
Jon Ward
  • 21
  • 2

0 Answers0