Backwards and cross-browser compatible audio playing

前端 未结 2 1042
-上瘾入骨i
-上瘾入骨i 2020-12-06 02:53

I need to playback audio files in many different web browsers and different versions. The old system produces 4-bit WAV files, which many browsers can\'t handle. All files c

2条回答
  •  遥遥无期
    2020-12-06 03:39

    With the HTML5 audio tag you can specify different audio types to attempt to load because each browser allows different types. There is a nice compatibility chart on this page: http://html5doctor.com/native-audio-in-the-browser/

    The below code will work with most browsers. It first attempts the new HTML5 audio method then falls back on the embed method.

    
    

提交回复
热议问题