Facing the prospect of losing YouTube from its popular streaming service, Roku announced Wednesday that the two companies have reached a deal to keep it there for at least a few years.