Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML HTML Video and Audio (Retired) Captioning Video The Track Element

Rob Bartlett
Rob Bartlett
6,741 Points

Adding Track element breaks video

I added the track element, and now pressing play on the video does nothing. Cut the <track> element out and it plays fine -- with no subtitles, obviously. Thoughts?

<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Video and Audio</title>

    <link rel="stylesheet" href="css/normalize.css">
    <link href='http://fonts.googleapis.com/css?family=Nunito:400,300' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/main.css">

    <h1>HTML Video and Audio</h1>

    <div class="wrapper">

      <h2>Video Example</h2>

      <video controls>
        <source src="http://treehouse-code-samples.s3.amazonaws.com/html-video-and-audio/bridge.mp4" type="video/mp4">
        <source src="http://treehouse-code-samples.s3.amazonaws.com/html-video-and-audio/bridge.ogg" type="video/ogg">
        <track label="English" kind="subtitles" srclang="en" source="bridge-captions.vtt" default>

      <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">



5 Answers

analyn jane calado
analyn jane calado
3,523 Points

:-)maybe! sometimes questions gets wrong.

your code seems fine, maybe something;s wrong with the .vtt file..please show me your code in the bridge-captions.vtt file thanks

Rob Bartlett
Rob Bartlett
6,741 Points

00:00:00.500 --> 00:00:05.000
[Truck Engine]

00:00:06.000 --> 00:00:10.000
[birds chirping]

00:00:13.000 --> 00:00:16.000
[School Bus Engine]

00:00:17.000 --> 00:00:24.350
[water flowing]

00:00:24.350 --> 00:00:30.000
[water flow continues]

Validates according to https://quuz.org/webvtt/ ...

Mabye u are not using the local server environment correctly on ur pc Try the teamtreehouse workspaces when hosting ur audio or video files, or use the Software MAMP for setting up ur local server enviornment on ur pc good luck Ill help u anytime

Rob Bartlett
Rob Bartlett
6,741 Points

Oh! In the <track> tag the source element needed to be "src" not "source."