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 Video and Audio (Retired) Media Basics The Audio Element

Dongyun Cho
Dongyun Cho
2,256 Points

Why this code doesnt work?

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

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

Am I missing something?

1 Answer

Owa Aquino
Owa Aquino
19,277 Points

Hi Dongyun,

Maybe this can help.

<video> and <audio> should have closing tag name and sources should be in different element of <source>

<h2>Video</h2>
<video width="320" height="240" controls>
  <source src="http://treehouse-code-samples.s3.amazonaws.com/html-video-and-audio/bridge.mp4" type="video/mp4">
</video> 

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

Hope this help! Cheers!

Owa

Dongyun Cho
Dongyun Cho
2,256 Points

I know this but I've learn that I can use the short version of what you've written. In my code, video tag works well, but audio one doesnt work!

Owa Aquino
Owa Aquino
19,277 Points

Hmmm maybe there's something wrong with the sample audio maybe it has been remove/moved or even renamed. Have you try adding your own audio? Try your local audio as a sample.

Cheers!