Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

HTML AUDIO AND VIDEO

I used the basic usage for video using the src inside the video tag. Then i used the audio with the source tag instead of embedding the src code inside the audio tag. Unfortunately it did not worked. The browser can only render the video. Can someone figure out what is the problem. Here is the code for both elements.

<div class="wrapper">
      <h2>Video example</h2>
      <video src="http://treehouse-code-samples.s3.amazonaws.com/html-video-and-audio/bridge.mp4" type="video/mp4" controls />
      <h2>Audio example</h2>
      <audio controls>
        <source src="http://treehouse-code-samples.s3.amazonaws.com/html-video-and-audio/bridge-audio.mp3"
        type="audio/mp3">
      </audio>

Moderator edit: Added Markdown tick marks for formatting purposes. I may suggest editing your post to review how to add this formatting for future posts to make code easier to read for others offering assistance. Thanks!

Your code is actually correct. It seems like the video may be covering up the audio. I suggest using two separate divs, so they will stack on top of each other, and you will see them both clearly, like so:

<div class="video">
      <h2>Video example</h2>
      <video src="http://treehouse-code-samples.s3.amazonaws.com/html-video-and-audio/bridge.mp4" type="video/mp4" controls />
</div>

   <div class="audio">
<h2>Audio example</h2>
      <audio controls>
        <source src="http://treehouse-code-samples.s3.amazonaws.com/html-video-and-audio/bridge-audio.mp3"
        type="audio/mp3">
      </audio>                           
   </div>

I used the self closing tags for both video and audio and it worked.