December 29, 2011

how to play wav stream in safari vai javascript

Question by Jeffrey Hsu

I’ve tried Audio / embed / Object, but fail at all of them.

play wave file is ok, but cannot play stream.

<audio><source src="sample.wav" /></audio> OK

<audio><source src="http://mydomain/stream" /></audio> fail

<object data="sample.wav"></object> OK

<object data="http://mydomain/stream"></object> fail

jPlayer also cannot work!

I found a clue:
If when I play it in firefox before, then safari works. It seems firefox download it so the safari can play it in quicktime’s cache.
code:
<embed src="http://10.224.91.28:8080/cas/auth.do?cmd=getaudiobycaptchaid&id=Q71UNBGRFOI00A8NDNBV76BTNE&clientid=9e1f73ca9d0ff1e07ca87f7660d1b911" height="45" width="170" type="audio/x-wav"/>

Answer by Starx

You should use html5audioplayer. It slags a bit, but works in the end….

...

Please fill the form - I will response as fast as I can!