user316323
user316323

Reputation: 1

Playing Audio in WPF with repeat on finish

Hi I want to create a audio player class but having some problems like when audio is finished it is not repeating. While playing audio some UI controls are not working.

Upvotes: 0

Views: 384

Answers (1)

Thomas Levesque
Thomas Levesque

Reputation: 292465

If you're using a MediaElement to play the audio, you can handle the MediaEnded event and call the Play method in the handler

Private Sub MediaElement_MediaEnded(ByVal sender As Object, ByVal e As RoutedEventArgs)

    Dim m As MediaElement = CType(sender, MediaElement)
    m.Play()

End Sub

Upvotes: 1

Related Questions