如何将警报附加到音频,javascript
How to attach an alert to audio, javascript
如何让第二个音频在第二个警报时播放?我上传了该网站以获取我正在尝试做的事情的示例。进入视频 3 秒后,我试图让警报出现。我做过的。我只需要知道如何获取音频,'sorry.wav?.wav?.wav',以便在第二次警报时播放,'Is something here with me?'
我根本不知道 javascript,所以请告诉我特定代码在我当前代码中的位置,因为我根本不知道。
此外,此站点用于艺术作业,因此如果这是不道德的或奇怪的,我会很抱歉,但此项目需要将音频附加到警报,反之亦然。
当前页面示例:
http://www.eves.website/second-original.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>eve_</title>
<link rel="icon" rel="preload" href="images/evecircle.png" />
<style>
#video {
margin-left:-10px;
margin-top:-10px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<style type="text/css">
body {
overflow:hidden;
}
</style>
<body onload="delayedAlert();">
<script>
var timeoutID;
function delayedAlert() {
timeoutID = window.setTimeout(slowAlert, 3000);
then.getElementsByTagName('audiotwo')[0];
}
function slowAlert() {
var audio= document.getElementsByTagName('audio')[0];
audio.play();
var myvar1;alert('Hello?')
audio.play();
var myvar2;alert('Is something here with me?');
}
</script>
<audio>
<source src="images/hellllloooo.wav" type="audio/wav" preload=true>
</audio>
<audiotwo>
<source src="images/sorry.wav?.wav?.wav" type="audio/wav" preload=true>
</audiotwo>
<video autoplay="autoplay" preload="auto" id="video" src="images/secondnew.mp4" width="1300px" height="auto" style="position:absolute; z-index:-1;" >
Video not supported.
</video>
</body>
</html>
<audiotwo>
无效 HTML,也将其命名为 audio
,并确保 src
为 well-formed:
<audio>
<source src="images/sorry.wav?.wav?.wav" type="audio/wav" preload=true>
</audio>
(真的是 images/sorry.wav?.wav?.wav
吗?尝试修改文件名)
然后select它通过
const audio2 = document.getElementsByTagName('audio')[1];
和
一起玩
audio2.play();
(将 alert('Is something here with me?');
之前的第二个 audio.play();
替换为 audio2.play();
)
如何让第二个音频在第二个警报时播放?我上传了该网站以获取我正在尝试做的事情的示例。进入视频 3 秒后,我试图让警报出现。我做过的。我只需要知道如何获取音频,'sorry.wav?.wav?.wav',以便在第二次警报时播放,'Is something here with me?'
我根本不知道 javascript,所以请告诉我特定代码在我当前代码中的位置,因为我根本不知道。
此外,此站点用于艺术作业,因此如果这是不道德的或奇怪的,我会很抱歉,但此项目需要将音频附加到警报,反之亦然。
当前页面示例:
http://www.eves.website/second-original.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>eve_</title>
<link rel="icon" rel="preload" href="images/evecircle.png" />
<style>
#video {
margin-left:-10px;
margin-top:-10px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<style type="text/css">
body {
overflow:hidden;
}
</style>
<body onload="delayedAlert();">
<script>
var timeoutID;
function delayedAlert() {
timeoutID = window.setTimeout(slowAlert, 3000);
then.getElementsByTagName('audiotwo')[0];
}
function slowAlert() {
var audio= document.getElementsByTagName('audio')[0];
audio.play();
var myvar1;alert('Hello?')
audio.play();
var myvar2;alert('Is something here with me?');
}
</script>
<audio>
<source src="images/hellllloooo.wav" type="audio/wav" preload=true>
</audio>
<audiotwo>
<source src="images/sorry.wav?.wav?.wav" type="audio/wav" preload=true>
</audiotwo>
<video autoplay="autoplay" preload="auto" id="video" src="images/secondnew.mp4" width="1300px" height="auto" style="position:absolute; z-index:-1;" >
Video not supported.
</video>
</body>
</html>
<audiotwo>
无效 HTML,也将其命名为 audio
,并确保 src
为 well-formed:
<audio>
<source src="images/sorry.wav?.wav?.wav" type="audio/wav" preload=true>
</audio>
(真的是 images/sorry.wav?.wav?.wav
吗?尝试修改文件名)
然后select它通过
const audio2 = document.getElementsByTagName('audio')[1];
和
一起玩audio2.play();
(将 alert('Is something here with me?');
之前的第二个 audio.play();
替换为 audio2.play();
)