0

This method is working in Chrome, IE etc. , but in Safari doesn't work. I was reading a lot of on this topic, but nothing helped me... I know that with QuickTime it works. This is a simple code for idea:

HTML

<div id="but"></div>
<audio id="first">
        <source src="song.mp3" type="audio/mpeg"/>
</audio>

JS

$("#but").mousedown(function(){
        songPlay();
    });

    function songPlay()
    {
        var audio = document.getElementById("first");
        audio.play();
    }

Much would help me some simple example with solution.

Mark Falex
  • 55
  • 1
  • 11
  • Does it work if you enable the controls to show and play it manually? – epascarello Jun 04 '14 at 18:41
  • What is the result of `audio.networkState`, `audio.readyState`, `audio.error` and `audio.canPlayType('audio/mpeg')` ? – Igor Gilyazov Jun 04 '14 at 19:32
  • In Mozzila this: NetworkState: 1 ReadySate: 4 Error: null In Safari this: NetworkState: undefined ReadySate: undefined Error: undefined And audio.canPlayType me threw an error, that it doesn't method. – Mark Falex Jun 09 '14 at 10:22

1 Answers1

2

After further clarification the OP is using safari 5.x on windows platform, that version of safari doesn't support the audio tag source, the solution would be to set a flash fallback or simply ignore that market share since apple killed support for safari on windows.

Patsy Issa
  • 11,113
  • 4
  • 55
  • 74