Search code examples
c#winformsmetadataaxwindowsmediaplayer

How can I make a windows media player control's URL truly null?


I am trying to modify my track's metadata, but I can't because the file I try to edit is constantly in use. I believe this is because my axwindowsmediaplayer control is still reading from the file. I want it to stop reading from the file so I can edit it, but it seems I can't make its URL property equivalent to nothing- it wants to keep the same URL if I tell it to set the URL to null or " ". If I give it an invalid URL though, it errors. How can I make it so its URL is actually null or better yet, make it so it stops reading from my file altogether?

 private void editTrackMetadataToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Form metaform = new MetaData();
        metaform.Show();
        Properties.Settings.Default.StopMedia = true;
        axWindowsMediaPlayer1.URL = null;//ahahahahahahaha
    }

Solution

  • According to the documentation, it is possible to release the current resource with the close method.