Safari won't play <audio> if .ogg file is first in the list? -


i have audio object 2 sources, in m4a , ogg formats.

the code follows:

<audio id="audio1" controls="controls" preload="none"> <source src="music.m4a" /> <source src="music.ogg" /> </audio> 

i can call document.getelementbyid('audio1').play() , starts playing.

it works in browsers. in safari, works if m4a file first source.

i.e. if have code ogg file first:

<audio id="audio1" controls="controls" preload="none"> <source src="music.ogg" /> <source src="music.m4a" /> </audio> 

safari won't react play() javascript call, mouse click on play button.

is there solution apart putting m4a file first?

thanks!

have tried telling browser mime type you're using.

use "audio/mp4" mime type (don't forget add .htaccess)

<audio id="audio1" controls="controls" preload="none"> <source src="music.oga" type="audio/ogg" /> <source src="music.m4a" type="audio/mp4" /> </audio> 

Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -