© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
Donut5162

❔ Closing media with MediaPlayer

Hello, I am trying to make an audio player that also allows the user to edit tag metadata using TagLib#.

When the user inputs their desired changes to the tag and clicks confirm, it should close the media, save the changes to the file, then open the media again.

The problem is that Close() seems to asynchronously close the media player, so by the time it is trying to save the changes to the file, the file sometimes is still being closed and is therefore in use by that other process, causing the save to fail.

There does not seem to be a 'MediaClosed' event for the MediaPlayer class, even though there is a 'MediaOpened' event. If there was, I would use that. I cannot use 'await', either.

Any ideas how I can go about this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ mediaplayer
C#CC# / help
2y ago
Overlapping sounds with mediaplayer?
C#CC# / help
16mo ago
Restarting audio with MediaPlayer?
C#CC# / help
4y ago
❔ MediaPlayer in WPF occasionally fails
C#CC# / help
3y ago