Skip to content

Commit

Permalink
Resolve #210: InvalidWmpVersionException on start when no WMP installed
Browse files Browse the repository at this point in the history
This is a partial revert of f8d9b41.

That change introduced reporting errors for custom sound playback, which is done via a Windows Media Player (WMP) dependency. Unfortunatley, it reports errors on startup instead of just when attempting to play a custom sound.

It's better to fail silently to play custom sounds than to show an error message for all users who don't have WMP installed, since use of custom sounds is rare. We'll fix playback of custom sounds as part of #173 by removing the WMP dependency.
  • Loading branch information
dziemborowicz committed Sep 28, 2021
1 parent 525ca4c commit 9a4ac71
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions Hourglass/Windows/SoundPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Hourglass.Windows
using System;
using System.Windows.Media;
using System.Windows.Threading;
using Hourglass.Managers;

using Hourglass.Timing;

/// <summary>
Expand Down Expand Up @@ -58,7 +58,6 @@ public SoundPlayer()
// File sound player
this.mediaPlayer = new MediaPlayer();
this.mediaPlayer.MediaEnded += this.MediaPlayerOnMediaEnded;
this.mediaPlayer.MediaFailed += this.MediaPlayerOnMediaFailed;
}

#endregion
Expand Down Expand Up @@ -335,16 +334,6 @@ private void MediaPlayerOnMediaEnded(object sender, EventArgs e)
}
}

/// <summary>
/// Invoked when an error is encountered in the <see cref="MediaPlayer"/>.
/// </summary>
/// <param name="sender">The <see cref="MediaPlayer"/>.</param>
/// <param name="e">The event data.</param>
private void MediaPlayerOnMediaFailed(object sender, ExceptionEventArgs e)
{
ErrorManager.Instance.ReportError(e.ErrorException.ToString());
}

#endregion
}
}

0 comments on commit 9a4ac71

Please sign in to comment.