0
votes

I'm trying to play a specific portion of a mp3 file using MediaElement. I understand that I can use the Position property to move to a specific time in the sound and start playing from there. But I would also like to restrict the duration when it plays. For example if a given mp3 file is 30 seconds long, i would specifically like to play the sound from 5th second to 10th second and want the playing to stop.

I thought about using a separate background thread or a timer callback that will measure the time and then wakeup to stop the mediaelement. But I was wondering if the MediaElement itself supports one such a way to specify the duration of the time to play.

1

1 Answers

2
votes

You can set Markers. Once a Marker is reached, the MarkerReached event is fired and you can stop the sound MediaElement there.