public static void ToggleMute(this IMediaPlayer player) { if (player == null) { throw new ArgumentNullException(nameof(player)); } if (player.IsMuted) { player.UnMute(); } else { player.Mute(); } }