Notalib / LYT

m.e17.dk
GNU Lesser General Public License v3.0
10 stars 12 forks source link

Unable to detect if playbackrate is working on IOS #471

Closed mzedeler closed 11 years ago

mzedeler commented 11 years ago

The playbackrate plugin for Modernizr doesn't work on IOS because of the firstplay limitation on this platform.

I found a possible workaround.

mzedeler commented 11 years ago

I have just written a workaround that solves the problem. Here is a patch for playbackrate.coffee:

   audio.appendChild source
   audio.playbackRate = rate
   audio.volume = 0
-  audio.play()
+  listener = ->
+    document.removeEventListener 'click', listener
+    audio.play()
+  document.addEventListener 'click', listener
 catch e
   # NOP

It turns out that the calculation of delta isn't working as expected. The values become very large, so this has to be fixed.

mzedeler commented 11 years ago

Fixed by SHA: 7c75b263df671df6a333505c76c2bdaed3a67f45