How to add subtitles from a external source in HTML5?

I’m trying to add subtitles from an external source in a video html but I can’t. I’m using the WebTorrent Technology, so, I’m streaming video torrents in my Browser and the <track> tag not works for me. Here’s the code that I use:
The code for subtitles it’s this:

var video = document.querySelector("video");
var track = video.addTextTrack("subtitles", "prompt", "en");
track.mode = "showing";

Thanks, i hope that you can help me!

Source: AngularJS