/// <summary> /// This function executes when a SpeechCue is hit and calls the functions to update the UI /// </summary> /// <param name="timedMetadataTrack">The timedMetadataTrack associated with the event.</param> /// <param name="args">the arguments associated with the event.</param> private async void metadata_SpeechCueEntered(TimedMetadataTrack timedMetadataTrack, MediaCueEventArgs args) { // Check in case there are different tracks and the handler was used for more tracks if (timedMetadataTrack.TimedMetadataKind == TimedMetadataKind.Speech) { var cue = args.Cue as SpeechCue; if (cue != null) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { if (timedMetadataTrack.Id == "SpeechSentence" || timedMetadataTrack.Id == "SpeechWord") { SpeechCueType type = timedMetadataTrack.Id == "SpeechSentence" ? SpeechCueType.Sentence : SpeechCueType.Word; var arg = new SpeechCueEventArgs(cue, type); SpeechCueChanged?.Invoke(this, arg); } }); } } }
internal SpeechCueEventArgs(SpeechCue cue, SpeechCueType type) { SpeechCue = cue; Type = type; }