javascript - What's causing this slow/delayed audio playback in Safari? -


var audio = new audio('data:audio/wav;base64,uklgroabaabxqvzfzm10ibaaaaabaaeaibuaaigvaaabaagazgf0yvwbaachlqa1xnlg7vv/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////tk1lsklhrkveq0jbqd8+pj08pds6ojk5otg4odg3nzc3nzc3nzc3nzc3nzg4odg5otk6ojs7ozw8pt4+p0baqujcq0rfruzhseljsktmtu5ot1brulnuvvvwv1hzwltcxv1ex2bhymnkzgvmz2hpawprbg1ubm9wcxfyc3r0dxz3d3h5exp6e3x8fx1+f3+agigbgokcg4oehisfhywghoahh4ehh4iiiiiiiiiiiiiiiiiiiiiiiiiiiiehh4ehhoaghywfhiseg4ocgogbgia=');  setinterval(function() {     audio.play(); }, 50); 

this code works correctly in chrome , firefox, in safari there's delay of on second between each sound. can't figure out why be, far can tell there no compatibility issues. want play sounds @ precise time , @ reasonably fast delay in game i'm making, how can working?

(copied the same question answered now)

safari displays curious behaviour when comes audio. seems like:

  1. with html5 audio tag, if audio less 500ms, volume in safari might fluctuate formats
  2. with html5 audio tag, delay obvious formats
  3. with flash audio player, delay obvious *.wav, it's fine *.mp3

considering on other platforms:

  1. ie9 doesn’t support native audio tag
  2. firefox’s audio sounds terrible when html5 audio tag used mp3/ogg format, okay wav.
  3. firefox fine flash audio player

to achieve compatibility across browsers:

  1. use flash audio player
  2. use mp3 , wav format
  3. put mp3 before wav

so sound manager 2:

soundmanager.setup({     url: './swf/',     flashversion: 9,     preferflash: true,     onready: function() {         soundmanager.createsound({             id: "button",             url: ["./audio/button.mp3", "./audio/button.wav"],             autoload: true,             autoplay: false,             volume: volume         });     } }); 

and play with:

soundmanager.play("button"); 

this should solve delay issue safari.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

angularjs - ng-repeat duplicating items after page reload -