Use XHR's load event instead of readystatechange + readyState === DONE
Set resolution option labels even if video metadata is already loaded, and other tiny fixes.
Added explanatory comments to example.