Need help with audio script (Not Playing???)

Im making a horror ARG apart of my site but theaudio script isnt working plz help!
35 Replies
Jochem
Jochem10mo ago
that src url looks suspicious, is there any error in the network tab of the dev tools?
diarrhea7516
diarrhea751610mo ago
Its not a URL its a local file improted to the FTP, i cant get it to play ill check tho No! Its empty
diarrhea7516
diarrhea751610mo ago
Jochem
Jochem10mo ago
reload the page with that tab open
diarrhea7516
diarrhea751610mo ago
diarrhea7516
diarrhea751610mo ago
@jochemm
Jochem
Jochem10mo ago
jeez, give me a second did you read the link I sent in #general? https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
diarrhea7516
diarrhea751610mo ago
I did, the code didnt work
Jochem
Jochem10mo ago
what happens when you copy the htdocs/... string up to and including .mp3 but not the quote, and then delete everything after the last / in the browser URL bar and paste the htdocs thing there? (and hit enter obviously)
diarrhea7516
diarrhea751610mo ago
Well its a wav file... And it didnt work
Jochem
Jochem10mo ago
"didn't work" is surprisingly unhelpful, what happened exactly?
diarrhea7516
diarrhea751610mo ago
Nothing at all. Just the image shaking (Witch i put in)
Jochem
Jochem10mo ago
what is in the URL bar right now then? and did you hit enter?
Jochem
Jochem10mo ago
so you didn't do any of this?
diarrhea7516
diarrhea751610mo ago
i did
diarrhea7516
diarrhea751610mo ago
Heres the entire script:
Jochem
Jochem10mo ago
is that live somewhere? Somewhere I can click a link and see that I mean
Jochem
Jochem10mo ago
I don't see the audio tag Did you add it and forget to upload it? right, so I refreshed the page because I ran into it closing tabs, and it seems like the audio tag was now added when I do this (which turns the URL into "gvtube.great-site.net/htdocs/the_screeches_of_hell.wav"), I get a 404 error if I go to http://gvtube.great-site.net/the_screeches_of_hell.wav (without the htdocs part), it downloads a wav file. You probably want to remove htdocs/ from the src attribute
diarrhea7516
diarrhea751610mo ago
@jochemm Tried that, dosent work...
Jochem
Jochem10mo ago
oh, I see, your HTML isn't well formed your audio tag is getting included in the style tag because you didn't close it there's just a mess of style tags and random stuff dumped in there, you really need to learn to format your document properly. You get really unexpected results if you don't properly open and close tags and keep your tags in the right places try this instead:
<!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>
<style>
body {
background-color: rgb(0, 0, 0);
}

img {
/* Start the shake animation and make the animation last for 0.5 seconds */
animation: shake 0.5s;
/* When the animation is finished, start again */
animation-iteration-count: infinite;
}

@keyframes shake {
0% {
transform: translate(1px, 5px) rotate(0deg);
}

10% {
transform: translate(-1px, -3px) rotate(-1deg);
}

20% {
transform: translate(-3px, 5px) rotate(1deg);
}

30% {
transform: translate(3px, 3px) rotate(0deg);
}

40% {
transform: translate(1px, -3px) rotate(1deg);
}

50% {
transform: translate(-1px, 5px) rotate(-1deg);
}

60% {
transform: translate(-3px, 3px) rotate(0deg);
}

70% {
transform: translate(3px, 5px) rotate(-1deg);
}

80% {
transform: translate(-1px, -3px) rotate(1deg);
}

90% {
transform: translate(1px, 5px) rotate(0deg);
}

100% {
transform: translate(1px, -3px) rotate(-1deg);
}
}

.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
</style>
</head>

<body>
<div class="box">
<img src="TELEDEATH.jpeg" width="1000" height="1000" />
<audio src="the_screeches_of_hell.wav" autoplay></audio>
</div>
</body>

</html>
<!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>
<style>
body {
background-color: rgb(0, 0, 0);
}

img {
/* Start the shake animation and make the animation last for 0.5 seconds */
animation: shake 0.5s;
/* When the animation is finished, start again */
animation-iteration-count: infinite;
}

@keyframes shake {
0% {
transform: translate(1px, 5px) rotate(0deg);
}

10% {
transform: translate(-1px, -3px) rotate(-1deg);
}

20% {
transform: translate(-3px, 5px) rotate(1deg);
}

30% {
transform: translate(3px, 3px) rotate(0deg);
}

40% {
transform: translate(1px, -3px) rotate(1deg);
}

50% {
transform: translate(-1px, 5px) rotate(-1deg);
}

60% {
transform: translate(-3px, 3px) rotate(0deg);
}

70% {
transform: translate(3px, 5px) rotate(-1deg);
}

80% {
transform: translate(-1px, -3px) rotate(1deg);
}

90% {
transform: translate(1px, 5px) rotate(0deg);
}

100% {
transform: translate(1px, -3px) rotate(-1deg);
}
}

.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
</style>
</head>

<body>
<div class="box">
<img src="TELEDEATH.jpeg" width="1000" height="1000" />
<audio src="the_screeches_of_hell.wav" autoplay></audio>
</div>
</body>

</html>
diarrhea7516
diarrhea751610mo ago
Still didnt work @jochemm
Jochem
Jochem10mo ago
this pops up in my browser now:
diarrhea7516
diarrhea751610mo ago
Th TH?
Jochem
Jochem10mo ago
if I change it to allowed it works
diarrhea7516
diarrhea751610mo ago
same, but it dosent loo[
Jochem
Jochem10mo ago
did you read the link I sent you? It describes in great detail how and why autoplaying audio doesn't work in a lot of cases
diarrhea7516
diarrhea751610mo ago
loop*
Jochem
Jochem10mo ago
add the loop attribute <audio src="the_screeches_of_hell.wav" autoplay loop>
diarrhea7516
diarrhea751610mo ago
OMG thx very much its working now!
Jochem
Jochem10mo ago
just remember, everyone else will also have to set that to allowed
diarrhea7516
diarrhea751610mo ago
I put the title as "PUT SOUND TO ALLOW" so they get the mom lmao
Jochem
Jochem10mo ago
👍
diarrhea7516
diarrhea751610mo ago
Well see ya later 🙂 @jochemm 1 sec. can i get code for dipalying an img rq?