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
Nouh Ahmed
7,085 PointsHTML 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>
Jo-wayne Josephs
19,748 PointsYour 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>
Nouh Ahmed
7,085 PointsI used the self closing tags for both video and audio and it worked.
Jay Padzensky
4,731 PointsJay Padzensky
4,731 PointsModerator 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!