I want to take a particular value of time (given in seconds by html5 htmlmedia timerange.end) and check where it falls in a list of times I already have that looks like this
00:00:00.00
00:00:22.00
00:01:21.00
00:01:36.00
00:01:51.00
00:02:06.00
00:02:21.00
00:02:36.00
I have these values hard-coded in a text file server side from the capture program.
I'd like to check and see in between which two values it (video_time) lies, and from there change the src in an iframe if the src does not correspond to the time slot, there are n times in the list above and corresponding n-1 slots in between them, the src will be named like /Slide0.html through /Slide[n-1].html.
So far I've created some logic to check the time, place holder logic to change the src of the iframe if the value is >15 sec and some callBack to call things periodically.
[EDIT: removed some irrelevant stuff]
Here is the problem:
function category() {
var played_ob =video_time_played() ;
if ( played_ob > 0 )
var played_num = played_ob;
else
var played_num = 0;
var tes = 15;
if ( played_num > tes)
document.getElementsByTagName("iframe")[0].src="/static/Slide1.html";
else
console.log ("meh");
};
Above I wish to check in which timerange it falls and set the proper iframe; this is what I need help with. What I would like to do is as follows:
/* PSEUDOCODE OF WHAT I WISH TO ACHIEVE BUT DONT KNOW HOW TO DO IT ENTIRELY.*/
function category (){
var time_spent = video_time_played_so_far_in_seconds();
/* this part i dont know, especially how to generate the list from a text file serverside */
categories_list = [list of consecutive times i showed above in HH:MM:SS.00]
var which_category = function check_in_between_which_two_times_var_lies () {
/*********** i DONT know how to code this part either, *******/
the_category_found_as_an_integer_between_0=>n-1 = ?
var category = the_category_found_as_an_integer_between_0=>n-1 ;
return category ;
}
function which_new_src (which_category) {
/* code to select new src */
var new_src = "/static/Slide"+which_category".html";
return new_src;
}
function change_src_of_iframe () {
var relevant_iframe = document.getElementsByTagName("iframe")[0];
change_src_of_iframe () {
var new_src = which_new_src(which_category);
relevant_iframe..src= new_src ;
}