W3C home > Mailing lists > Public > public-audio@w3.org > January to March 2014

Problems with simple oscillator and Safari on IOS 7

From: s p <sebpiq@gmail.com>
Date: Wed, 29 Jan 2014 18:19:43 +0100
Message-ID: <CAGKuoCXJ8zCu57gzTd2m068ATBmP+_NUA7ByJjS0uBwkjydONg@mail.gmail.com>
To: "public-audio@w3.org" <public-audio@w3.org>
Hi!

I'm desperately trying to have a simple oscillator running on a page with
safari on IOS 7. I thought it should be supported, but after trying
everything, I'm losing hope. It works on chrome, and pretty much everywhere
else web audio is supported.

In fact, I have tried many examples from the web with Safari, none of them
works. Is there a catch with Safari on IOS?

Cheers,

PS : Here is the code I am trying to run :

<!DOCTYPE html><html><head>
  <title></title>
  <script src="js/jquery-2.0.3.min.js"></script></head>
<body style="background:#000; padding:0; margin:0;">

  <button id="play">PLAY</button>

  <script>
    var audioContext, osc
    $('#play').click(function() {
        audioContext = new (window.AudioContext || window.webkitAudioContext);
        osc = audioContext.createOscillator()

        osc.connect(audioContext.destination)
        if (osc.noteOn) osc.start = osc.noteOn
        osc.start(0)
        osc.frequency.value = 440
        $('body').css({'background-color': 'green'})
    })
  </script>
</body>
</html>




-- 

*Sébastien Piquemal*

 -----* @sebpiq*
 ----- http://github.com/sebpiq
 ----- http://funktion.fm
Received on Wednesday, 29 January 2014 17:20:11 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:12 UTC