Egon
Egon

Reputation: 3848

WP7 updating UI dynamically without blocking thread

I am making sort of a karaoke app, where I need to tie in timestamped text-data with audio data. I have 2 lists to indicate start and end of audio timespans and text string indices. The issue that I am facing is I don't know how to update the highlighted text based on current media element's POSITION property.

WP7 doesn't have the Marker reached event ( which silverlight has ). So I was considering use of a DispatcherTimer. the issue with this is that the ticks that I want are non-uniform, and if I update the interval property every tick, the accuracy of the timer will fall greatly, as the media element's position and timer's tick will fall out of sync pretty easily.

Any idea how I get create my event similar to MarkerReached event of the Media element ? Thank you-Egon

Upvotes: 3

Views: 587

Answers (1)

Derek Lakin
Derek Lakin

Reputation: 16319

I presume you have some form of data structure that tells you where the markers are in the audio stream, so why not use a DispatcherTimer with a fixed Interval (say 500 milliseconds) and simply check against this data structure to see if you've reached a marker?

Upvotes: 1

Related Questions