William marries someone else (I've no idea who, but needless to say she won't be as high-ranking or as closely related as Mary) after the suitable mourning period and maybe has a son, thereby avoiding the Second Stadtholderless Period; 'William IV of Orange' goes on to great things given his upbringing, yada yada. As long as Anne Hyde dies at the right time and York remarries to Mary of Modena - he'll be extremely keen to get an heir, so I don't see why he wouldn't, unless it was to marry Arabella Churchill for similar reasons as Anne Hyde - then William III will be the first-place Protestant heir. Now, Charles II will demand that James raise any later-born kids Anglican, but after he dies his wishes will be meaningless. James II will raise his heir Catholic as soon as he becomes King, be he Alt-Old Pretender or a legitimate brother of the Duke of Berwick, and this, compounded with James' absolutist tendencies, will make the situation in England similar to OTL.
So, now, either Monmouth's Rebellion succeeds (I don't see why it would); William III invades and becomes King (even more likely given that he was closer in the line of succession); someone else forces James to abdicate to his son, to be raised in the right faith (James would rather flee to France, kids and all); Commonwealth 2.0; or a surprise random contender comes a-knocking, like the Elector Palatine or the Duke of Somerset or someone.
If William still wins, he has at least one son, so the House of Orange is secure on the British thrones, we don't get the Act of Settlement, no Georges, and possibly a short-lived Anglo-Dutch personal union (Yay! Personal Union Time on alternatehistory.com!) that will pretty much end whenever the Estates of Holland (hegemonic over the Estates-General) get bored of kowtowing to London. So, in contrast to my opening sentence, there will be a Second Stadtholderless Period.