Given this script:
<html>
<head>
<script>
var sentences=
[
['journey27.mp4',
[
[1, 2],
[5, 7]
]
],
['journey28.mp4',
[
[10, 12],
[13, 17],
[25, 36]
]
],
['journey30.mp4',
[
[13, 15],
[15, 19],
[21, 30]
]
]
];
function playVideo(myUrl, startTime, endTime) {
var video = document.getElementById("myVideo");
video.src = myUrl;
video.currentTime=startTime;
video.play();
var maxTime = endTime;
video.addEventListener("timeupdate", function(){
if(video.currentTime >= maxTime){
playVideo(myUrl, startTime, endTime);
}
}, false);
}
function myLoop(){
I want to loop each pairs 5 times before jump to the next pair
}
</script>
</head>
<body>
<video id="myVideo" width="1000" height="800" controls autoplay loop>
Your browser does not support the video tag.
</video>
<br>
<a onclick="myLoop()" > Play </a>
</body>
</html>
Now I want to fill in myLoop function.
I want to loop each pairs 5 times before jump to the next pair in the array.
For example,
-the first pair: 'journey27.mp4', loop "[1, 2]" 5 times
then the next pair: 'journey27.mp4', loop "[5, 7]" 5 times
then the next pair: 'journey28.mp4', loop "[10, 12]" 5 times
then the next pair: 'journey28.mp4', loop "[13, 17]" 5 times
and so on
Note: The playVideo function above works
How can I loop through this array using javascript?