Video doesn't load on initial load

I have been trying to figure this out for a while and I need some help. When I load the page for the first time, the video player does not appear. If I refresh the page, it will load.

I tried using the Jquery load method, but I couldn’t even get an alert to work. I am new to javascript. I have been coding with AS3 for the past six months and now I am making the transition to Javascript.


<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
 	$(document).ready(function () {
 	$('#player_if').load("js/video_player.js", function {
 		alert("loaded");
 	});
</script>

This code is on my local version, I have not uploaded it to the server.

I suggest that you try using the video.js library, which helps to resolve many issues that are commonly faced.

I am using the YouTube API to feed the videos through the custom player. I don’t want to have the videos hosted locally.