Problems with video timing and with video starts

I can describe to problems on my work related to video:
http://tv.hotelpuertobahia.com/invierno/index.html

First,
I use a Asus Chromebit to play the html5 and some times the video stars seconds later. May be a loading issue, the first time the video plays is the worse. Any advice on preloading video files?. Or may be a problem related processor capacity but I doubt It. Or may be a format problem. I use mp4 o m4v. I use Handbrake 2 utility to compress the size of each video, just 22mb. And I reduce the frame format to 12080x738, even knowning the tv format is FullHD, to reduce the Asus Chromebit processor needs.
I use just two videos. Each one on separated scenes also to reduce Asus Chromebit processor needs.
This problem appear on Asus Chromebit but not on PC Chrome browser.
Any one has an advice to get proper execution of those videos on Asus Chromebit?

Second,
the first problem (video stars seconds later) causes scene ends before the video ends. And also a time offset because the script I use to set time to zero, on scene unloading, doesn’t work at all. I use the following scrip in order to rewind the videos:

	var video_1 = document.getElementById('video_es');  
	var video_2 = document.getElementById('video_en');
	
video_1.pause();
video_2.pause();

video_1.currentTime = 0;
video_2.currentTime = 0;

I insert the javascript on the scene edit window and not the timeline, on unloading scene script field.
What is the best place to use this javascript? Any error on the javascript?

@Daniel, I have read your instructions about these matter, but I can’t get it done.
Any help, please?

Hey Juan:

Browsers determine when a video is 'ready to play', so even if 1 second of the video file is downloaded, if you run a play command, the video might not think enough has been downloaded to play.

Make sure the codec you use is h264 when encoding with Handbrake. Most processors, even little ones like the Chromebit, have acceleration for that codec.

Here's how you can detect when a video with the ID thevideoID has ended:

document.getElementById('thevideoID').addEventListener('timeupdate', function() {
      var videoCurrentTime = document.getElementById('thevideoID').currentTime;
      // if the video has played for 15 seconds, do X 
      if (videoCurrentTime >= 15) {
        // do something 
}

Can you share a document?

You meant Hype document?
https://drive.google.com/drive/folders/0BzAT-d7f2vkNdXVMZk5sdGZJQ1k?usp=sharing

I don't know if I need to know that the video has ended. More useful is to be sure that the videos time has been reset to zero for the next html loop. To be sure that the script is working? No way to know if javascripts are taking effect and if not, why not?