# Adding captions and subtitles to HTML5 video

**URL:** https://discourse.mozilla.org/t/adding-captions-and-subtitles-to-html5-video/51604
**Category:** Learn
**Created:** [January 8, 2020, 4:28pm UTC](https://discourse.mozilla.org/t/adding-captions-and-subtitles-to-html5-video/51604 "2020-01-08T16:28:34Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![andreeapetrescu16](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@andreeapetrescu16](https://discourse.mozilla.org/u/andreeapetrescu16)
#### Post date: [January 8, 2020, 4:28pm UTC](https://discourse.mozilla.org/t/adding-captions-and-subtitles-to-html5-video/51604/1 "2020-01-08T16:28:34Z")

</div>

Hello again @chrisdavidmills. I did the “Captioned video example”. I encountered some difficulty with the subtitles, I don’t understand why they don’t work.  
I don’t know if you can mark it as there is a video inside and on CodePen it can’t be reproduced. Anyway, if you want to take a look this is the URL : [https://codepen.io/Andreea96/pen/BaymoKL](https://codepen.io/Andreea96/pen/BaymoKL) .

---

<div class="post-metadata">

### Author: ![chrisdavidmills](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/chrisdavidmills/32/21688_2.png) [@chrisdavidmills](https://discourse.mozilla.org/u/chrisdavidmills)
#### Post date: [January 10, 2020, 9:38am UTC](https://discourse.mozilla.org/t/adding-captions-and-subtitles-to-html5-video/51604/2 "2020-01-10T09:38:03Z")

</div>

@andreeapetrescu16 it looks like you are getting a cross-domain error, and it is not loading the VTT file as a result. On your page, in the web console it is reporting:

```auto
Security Error: Content at https://cdpn.io/Andreea96/fullpage/BaymoKL may not load
 data from https://codepen.io/Andreea96/fullpage/subtitle/sintel-en.vtt.

```

The way codepen is working, your page is at a different domain to your VTT file, which explains the error. Maybe try putting the example together in a github repo, and use gh-pages?

---

<div class="post-metadata">

### Author: ![andreeapetrescu16](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@andreeapetrescu16](https://discourse.mozilla.org/u/andreeapetrescu16)
#### Post date: [January 10, 2020, 11:45am UTC](https://discourse.mozilla.org/t/adding-captions-and-subtitles-to-html5-video/51604/3 "2020-01-10T11:45:22Z")

</div>

Like this : [https://github.com/Andreea1696/Captions](https://github.com/Andreea1696/Captions) ?

---

<div class="post-metadata">

### Author: ![chrisdavidmills](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/chrisdavidmills/32/21688_2.png) [@chrisdavidmills](https://discourse.mozilla.org/u/chrisdavidmills)
#### Post date: [January 13, 2020, 10:47am UTC](https://discourse.mozilla.org/t/adding-captions-and-subtitles-to-html5-video/51604/4 "2020-01-13T10:47:15Z")

</div>

This looks set up right.

So now you can get GitHub to render this as a live website by activating github pages, after which the page should be available at [http://andreea1696.github.io/Captions](http://andreea1696.github.io/Captions) (I think?)

So basically go to the repo, go to “Settings”, and then scroll down to the " GitHub Pages" section. Then choose your master branch as the branch to build gh-pages from.

---

<div class="post-metadata">

### Author: ![andreeapetrescu16](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@andreeapetrescu16](https://discourse.mozilla.org/u/andreeapetrescu16)
#### Post date: [January 13, 2020, 1:16pm UTC](https://discourse.mozilla.org/t/adding-captions-and-subtitles-to-html5-video/51604/5 "2020-01-13T13:16:42Z")

</div>

Ok, done. Thank you very much.  
One last question: if I open this exmple on GitHub, I can see the subtitles (subtitles work). If I open it on my local drive with Chrome the subtitles don’t work. I’d like to know which is the reason why they don’t work.
