我正在尝试在Safari上播放一个简单的HTML5音频标签,这是我的代码:
const express = require('express');
var http = require('http');
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
const app = express();
// [START hello_world]
app.get('/test', (req, res) => {
const Http = new XMLHttpRequest();
const url='https://www.google.com';
Http.open("GET", url);
Http.send();
Http.onreadystatechange=(e)=>{
console.log(Http.responseText)
}});
// [END hello_world]
if (module === require.main) {
// [START server]
// Start the server
const server = app.listen(process.env.PORT || 8080, () => {
const port = server.address().port;
console.log(`App listening on port ${port}`);
});
// [END server]
}
module.exports = app;
我试图用document.createElement创建一个元素并将其注入文档中,并尝试使用new Audio()并尝试了这种模式:
<audio controls>
<source src="https://www.tarteel.io/media/56_85_3040853518.wav" type="audio/wav" />
</audio>
有什么帮助吗?这是我的全部代码。