Refactor video autoplay