Build an HTML Audio and Video Player - Build an HTML Audio and Video Player

Tell us what’s happening:

In my opinion I’ve a problem at audio element please help because 17th test is failed.

Your code so far

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>HTML Audio and Video Lab</title>
</head>
<body>
<h1>HTML Audio and Video Lab</h1>
<section>
  <h2>What is the map method and how does it work</h2>
  <video width="640" controls>
    <source src="https://cdn.freecodecamp.org/curriculum/labs/What is the map method and how does it work.mp4" type="video/mp4"></video>
</section>
<section>
  <h2>Sailing Away</h2>
  <audio controls loop>
    <source src="https://cdn.freecodecamp.org/curriculum/js-music-player/sailing-away.mp3" type="audio/mpeg"></audio>
</section>
</body>
</html>

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:143.0) Gecko/20100101 Firefox/143.0

Challenge Information:

Build an HTML Audio and Video Player - Build an HTML Audio and Video Player

Hi! You should not use a source element for the audio part. Instead, put the src attribute directly in the audio element.

2 Likes

Hey there! Just checked your code—turns out the audio part’s tiny mix-up! The <source> tag works great for <video>, but for <audio>, you can just pop the audio link right into the src attribute (like code removed by moderator). Fix that and the 17th test should pass in no time!

1 Like

it’s great you want to help, but we don’t share solution code that can be copy and pasted here, but also, the syntax you are proposing is wrong, I suggest you review the topic before helping :slight_smile:

@ILM I followed everything according to HTML Audio standards with the following code

<audio controls loop>
  <source src="https://cdn.freecodecamp.org/curriculum/js-music-player/sailing-away.mp3" type="audio/mpeg">
</audio>

and the solution did not work until I did what @yhc2073 stated using the following

<audio controls loop src="https://cdn.freecodecamp.org/curriculum/js-music-player/sailing-away.mp3">
  <source src="https://cdn.freecodecamp.org/curriculum/js-music-player/sailing-away.mp3" type="audio/mpeg">
</audio>

I understand that you are trying to help learners learn. However, this learner (I) would have been stuck on this for another hour forced to reach out for support. The site should be checked to see if there are any issues before disregarding someones workaround that they discovered.

I am not disregarding someone’s workaroud, it is a forum policy to not share solutions

Thank you for that.
I was following w3schools guidelines, and step 18 wouldn’t pass.

1 Like