网页上放一个audio元素
<audio id="aud"></audio>
将这个元素的src属性绑定数据流
websocket.onmessage = function (event) {var audio = document.getElementById('aud'); if (window.URL) {audio.src = window.URL.createObjectURL(event.data); } else {audio.src = event; } audio.autoplay = true; }