Using JavaScript to stop a looping video at specific time

I have a video that loops twice. On the second loop I want the video to stop at 8 seconds.

Am I missing something or am I making this more complicated than it is?

This is what I have tried so far:

<!DOCTYPE html> 

<p>Press play and wait for the video to end.</p>
<div>Iteration: <span id="iteration"></span></div>
<video autoplay id="myVideo" width="320" height="176" controls>
  <source src="mov_bbb.mp4" type="video/mp4">
  <source src="mov_bbb.ogg" type="video/ogg">
  Your browser does not support HTML5 video.

var iterations = 1;

document.getElementById('iteration').innerText = iterations;

myVideo.addEventListener('ended', function () {    

    if (iterations < 2) {       

        this.currentTime = 0;;
        iterations ++;

        document.getElementById('iteration').innerText = iterations;


}, false);


video.addEventListener('timeupdate', function () {
    if (mediaPlayer.currentTime > stopframes[0]) {

<p>Video courtesy of <a href="" target="_blank">Big Buck Bunny</a>.</p>