improved javascript for loading and enqueuing videos