Reputation: 20132
Im very new to WP development...
using following code to play an audio
<MediaElement x:Name="MediaSound" HorizontalAlignment="Left" Height="100" Margin="76,60,0,0" VerticalAlignment="Top" Width="100" Visibility="Collapsed" Source="/sounds/build.wav" />
I need to change the source of media element dynamically.. Lets assume i have 10 audio file and i want to play it one after another...
For that i want to know when the audio is stopped . Is there any listener available like in android OnCompletionListener...
I want some thing like this...
private void genarateSound(){
MediaSound.Source = new Uri(audioPath[counter], UriKind.Relative);
MediaSound.Play();
//Just to say
MediaSound.Oncomplete+ = new OnComplete(AudioPlayComplete); //listen to audio Complete *Somthing like this*
}
//Code segment to execute when audio is stopped
AudioPlayComplete
{
counter++;
genarateSound();
}
Any help is much appriciated.. TIA.
Upvotes: 0
Views: 102
Reputation: 4303
View the following code sample to see how to call and use MediaEnded:
Upvotes: 0
Reputation: 84724
The MediaEnded
event will fire when the media reaches the end.
Upvotes: 1