Hi Yair,
Here's how Shaka's text support works:
We have a series of plugins in the source that provide support for text. A plugin registers itself with TextEngine and is invoked by TextEngine to parse the text stream. Registration is based on MIME type. Each time the plugin is called, TextEngine feeds it a segment or complete text file and the plugin returns an array of the parsed cues. TextEngine then feeds those cues into the browser.
There's nothing in our design that offers a natural point to pass you the WebVTT URLs. In fact, in the general case, there may be many over time (due to segmented text), we may not know their URLs upfront (due to SegmentURL or SegmentTimeline in the manifest), or there may even "infinitely" many over time (due to live streams).
However, you may be able to get what you want by simply registering your own WebVTT parser with TextEngine. I see from
vtt.js's website that the entry API is very similar to our own parser plugin API. So it would seem you could simply write a text plugin that passes our data on to your parser, and then just return an empty array. StreamingEngine and TextEngine will be perfectly happy with this, and you can handle WebVTT the way you want to.
Here's what that might look like:
ExternalVttTextParser = function(data, segmentStartTime, segmentEndTime) {
var parser = new WebVTT.Parser(window);
// ...
parser.parse(data);
parser.flush();
return [];
};
shaka.media.TextEngine.registerParser('text/vtt', ExternalVttTextParser);
The registration of your parser will replace our default parser for WebVTT. You can also choose to
customize the build to remove our parser and/or add yours at compile time.
Does this help?
-Joey