To prevent YouTube from switching sources when resizing the content, select a specific quality first (it defaults to “Auto”). I wouldn't be surprised if there were browser extensions that automatically do this (e.g. always choose the highest quality).