Skip to content

Conversation

@marijnz0r
Copy link
Contributor

Clean up the IPlayer interface to be loosely coupled to the implementation. This opens up reusing the interface for usage in other implementations not coupled to the NAudio package.

catch (System.NullReferenceException)
{
}
this.outputDevice.Pause();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing this PR, it seems that the pause button isn't working. After some review, it appears that lines 40-41 inside the Player method are creating a new instance of audioFileReader and outputDevice each time the Play button is pressed, which resets the pause method.

My solution was to move the initialization inside an if statement inside the Play method like so:

public void Play(string path)
{
if (this.outputDevice.PlaybackState == PlaybackState.Stopped)
{
this.audioFileReader = new AudioFileReader(path);
this.outputDevice.Init(this.audioFileReader);
}
this.outputDevice.Play();
}

@markjamesm markjamesm merged commit f80bda9 into markjamesm:main Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants