Piecemeal insertion of webvtt captions

Topics: Windows 8 Xaml
Nov 14, 2014 at 12:12 AM

I'm trying to display webvtt captions that are fead to my application by third party software module. This software provides us with a segments of the vtt file as we digest and display video.


00:00:09.306 --> 00:00:11.641
If I paid somebody ten cents
 to come up with that,

00:00:11.641 --> 00:00:12.642
 I would kill him. 
All the examples I have found set the source of the vtt file. (i.e. myMediaPlayer.AvailableCaptions.Find(c => c.Description == "English").Source = new Uri("http://smf.blob.core.windows.net/samples/win8/captions/captions.vtt"); ). If I do the same I can display captions but this is not the scheme I can use. I have to provide the segments to captions a segment at a time. What I have tried so far is the following:

When I enable the captions I set the selected caption.
myMediaPlayer.SelectedCaption = myMediaPlayer.AvailableCaptions.Find(c => c.Description == "English");
In the callback that provides the segment of the vtt file I have the following:
async void handleVttSegment(string vttSegment)
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                this.myMediaPlayer.SelectedCaption.Payload = vttSegment; // Tried this.                                           
                this.myMediaPlayer.SelectedCaption.AugmentPayload(vttSegment, startTime, endTime);  // And this but of coarse one or the other.
When using AugmentPayload() the startTime and endTime were set so that start time is before the cue and the end is after.

What would be the correct way?