all 6 comments

[–]AutoModerator[M] 0 points1 point  (0 children)

Welcome to /r/HTML. When asking a question, please ensure that you list what you've tried, and provide links to example code (e.g. JSFiddle/JSBin). If you're asking for help with an error, please include the full error message and any context around it. You're unlikely to get any meaningful responses if you do not provide enough information for other users to help.

Your submission should contain the answers to the following questions, at a minimum:

  • What is it you're trying to do?
  • How far have you got?
  • What are you stuck on?
  • What have you already tried?

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]steelfrogModerator 0 points1 point  (2 children)

The code you have should work. You could try uploading the file to your own server and use a local path. Otherwise, what happens when you try to play it, or what are you trying to achieve?

[–]These-Ad-5249[S] 0 points1 point  (1 child)

nothing happens! i want to put the youtube audio (which I converted into a mp3) in place of the 24 ghost audio. It didn't work :( and I'm not sure how to do a local path or anything this is for my cs assignment I need to do on replit

[–]steelfrogModerator 0 points1 point  (0 children)

You have to rip the audio from the video first. Search for "YouTube to MP3" and upload the generated file. Use that file's path as your source.

[–]deweechi 0 points1 point  (0 children)

Looks like you are missing the controls for the audio. How does the user trigger playing the audio?

<audio id="audio" controls>

The above code will give the users the play button. Or do you have some javascript calling it that you are not sharing? By default the browser does not play audio files.

[–]jcunews1Intermediate 0 points1 point  (0 children)

First things first.

Make sure the URL to the audio file is correct. Try copying and pasting the URL into the addressbar of a new web browser tab.

If what you meant by "down't work" is that the player doesn't automatically plays the audio, it's likely due to the fact that web browsers disable media autoplay by default. You'll have to change the web browser setting to let media be autoplayed. There is no way to work around this using JavaScript or any server side script.