<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <body> <audio controls="controls" ></audio><!-- 第一种方式,通过ajax去后台获取文件流, 需要我们拼接获取的流,然后放入audio播放 --> </body> <script> $.get("http://127.0.0.1:9083/v1/gateway/get", function (data) { document.getElementsByTagName("audio")[0].setAttribute("src", "data:audio/wav;base64,"+data.data); }); </script> </html>