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

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

Video Captions valid but not showing

Hello my fellow students.

I have something of a mystery on my hands.

A have a video, basic HTML page and a Track element to display a caption on it.

If it helps, later on I'll post the page with the video but at the moment I'm at a loss.

<!DOCTYPE html>
<html>
    <head>
        <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'>
    </head>

    <body>
    <h1>Basic HTML Video</h1>

    <video class="" autoplay controls>
        <source src="olympic.mp4" type="video/mp4">
        <track label="English" kind="subtitles" srclang="en" src="caption.vtt" default>

    </video>

    </body>

</html> 
caption.vtt

WEBVTT FILE

0
00:00:04.000 --> 00:00:20.000
["Hands out, hands out." The relay patrol starts to come]

The fact I haven't named a class for the video tag shouldn't matter. The files are all in the same location so the source references are correct. There's nothing I can see wrong with the Track element. I've validated the caption file.

The only other thing I can think of is that it needs a captions boolean value for the video element?

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

Alright.... well I did eventually upload a version to my webspace. And it seems to display the caption.

So I'm guessing this is something that needs to be put online for it to show properly.

Here's the link [http://www.jonniegrieve.co.uk/lab/video/video.html]

Yeah, looks fine to me.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,254 Points

Yes there is only one caption at the moment so no problems there. And it does work when putting it onlne

I also had a problem later when the video itself wouldn't show up. Although my assumption there is that's because I haven't sourced multiple formats. :-)