Changing video hack to wait until document is loaded