<!DOCTYPE html>
<html>
<title>Clicking on YouTube Embedded Iframe - RJM Programming - June, 2016 - via Google YouTube API https://developers.google.com/youtube/iframe_api_reference</title>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes" >
<script type='text/javascript'>
var iframegridmode=false;
var urlis='';
var dostumps=true;
var vwidth=640;
var vheight=390;
var hone=1;
var vidarr;
var one=0;
var cntpause=0;
var onepause=0;
var tobechecked=null;
var thistext='';
var nexttext='2';
var nextvid='';
var prevvid='';
var nexturl='';
var prevurl='';
var of=' 1 of 1 ';
var cnt=0;
var toggle=1;
var secscnt=location.search.split('start=')[1] ? location.search.split('start=')[1].split('&')[0] : 0;
var oursecscnt=secscnt; // for Karaoke purposes ... September, 2016
var suffix="#t=00m00s";
var presuffix="";
var wo=null;
var yturl='';
var playtime=4000;
var delay=1300;
var vlen=0;
var eventtarget=null;
var duration=-1;
var previd="7o9wvYXR3n0";
var vid="7o9wvYXR3n0";
var play_list_id='';
var hm=2;
var anymore='';
var oknow=true;
var gtn="Go to next on the list";
var pgtn="Go to previous on the list";
var kpi=-9;
var player;
function sendoff() {
if (urlis != '') {
//alert(urlis);
document.getElementById('fgrid').submit();
//location.href=urlis;
//urlis='';
}
}
function iframemode(inoup) {
// ?total=9&tag=div&period=4000&from=%3ciframe src%3d%22hb11.jpg%22%3e%3c/iframe%3e&to=%3ciframe src%3d%22bb11.jpg%22%3e%3c/iframe%3e
urlis='';
var suff='?', total=0;
retval=inoup;
vidarr=inoup.split(',');
for (var jk=0; jk<9; jk+=1) { //2) {
if (jk < vidarr.length) {
total++;
} else {
total++;
document.getElementById('p' + eval(eval(jk + 1) / 1)).value='?total=9&tag=div&period=4' + eval(eval(jk + 1) / 1) + '00&from=&to=';
}
}
for (var ik=0; ik<9; ik+=1) { //2) {
if (ik < vidarr.length) {
if (urlis == '') urlis='http://www.rjmprogramming.com.au/HTMLCSS/reveal_div.php';
if (eval(10 + ik) < vidarr.length) {
document.getElementById('p' + eval(eval(ik + 1) / 1)).value='?total=' + total + '&tag=div&period=4' + eval(eval(ik + 1) / 1) + '00&from=' + vidarr[ik] + '&to=' + vidarr[eval(10 + ik)];
urlis+=suff + 'p' + + eval(eval(ik + 1) / 1) + '=' + encodeURIComponent('?total=' + total + '&tag=div&period=4' + eval(eval(ik + 1) / 1) + '00&from=' + vidarr[ik] + '&to=' + vidarr[eval(10 + ik)]);
suff='&';
retval=retval.replace(vidarr[ik] + ',' + vidarr[eval(1 + ik)], '');
} else {
document.getElementById('p' + eval(eval(ik + 1) / 1)).value='?total=' + total + '&tag=div&period=4' + eval(eval(ik + 1) / 1) + '00&from=' + vidarr[ik] + '&to=' + vidarr[ik];
urlis+=suff + 'p' + + eval(eval(ik + 1) / 1) + '=' + encodeURIComponent('?total=' + total + '&tag=div&period=4' + eval(eval(ik + 1) / 1) + '00&from=' + vidarr[ik] + '&to=' + vidarr[ik]);
suff='&';
retval=retval.replace(vidarr[ik], '');
}
if (retval != '') {
if (retval.substring(0,1) == ',') {
retval=retval.replace(',','');
}
}
}
}
if (retval != inoup) {
if (retval == '') {
setTimeout(sendoff,500);
//document.getElementById('fgrid').submit();
} else {
setTimeout(sendoff,500);
document.getElementById('fgrid').target='_blank';
//document.getElementById('fgrid').submit();
}
} else {
urlis='';
}
return retval;
}
function force_next() {
if (nexturl == '') {
if (prevurl.indexOf('this=') != -1) {
pgtn="Go to previous Video on the list";
if (("" + prevvid).length > ('cGdz3GNhEQ4').length) pgtn="Go to previous Playlist on the list";
return "<br><a target='_self' href='" + prevurl + "' title='Go to previous'>" + pgtn + "</a>";
}
return "<br><a target='_self' href='" + document.referrer + "' title='Go to previous'>Go to previous</a>";
}
gtn="Go to next Video on the list";
if (("" + nextvid).length > ('cGdz3GNhEQ4').length) gtn="Go to next Playlist on the list";
if (prevurl.indexOf('this=') != -1) {
pgtn="Go to previous Video on the list";
if (("" + prevvid).length > ('cGdz3GNhEQ4').length) pgtn="Go to previous Playlist on the list";
return "<br><a target='_self' href='" + prevurl + "' title='Go to previous'>" + pgtn + "</a>" + "<br><a target='_self' href='" + nexturl + "' title='Go to next'>" + gtn + "</a>";
}
if (document.referrer.indexOf('this=') != -1) {
return "<br><a target='_self' href='" + document.referrer + "' title='Go to previous'>Go to previous</a>" + "<br><a target='_self' href='" + nexturl + "' title='Go to next'>" + gtn + "</a>";
}
return "<br><a target='_self' href='" + nexturl + "' title='Go to next'>" + gtn + "</a>";
}
function etc_quality() {
return "<br>Quality <select id=iqty onchange=' player.setPlaybackQuality(this.value); '><option value='highres'>highres</option><option value='hd1080'>hd1080</option><option value='hd720'>hd720</option><option value='large'>large</option><option value='medium' selected>medium</option><option value='small'>small</option><option value='unknown'>unknown</option></select>" + force_next();
}
function etc_playbackrate() {
return "<br>Playback Rate <select id=ipbr onchange=' player.setPlaybackRate(this.value); '><option value='0.25'>x 0.25</option><option value='0.5'>x 0.5</option><option value='1.5'>x 1.5</option><option value='1' selected>x 1</option><option value='2'>x 2</option></select>" + etc_quality();
}
function etc_volume() {
return "<br>Volume <input id=ivol onchange=' player.setVolume(this.value); ' type=number min=0 max=100 step=1 value=0></input>" + etc_playbackrate();
}
function postprompt(inp) {
if (inp == null) return "";
if (inp.indexOf('+') != -1) iframegridmode=true;
var oup=inp;
while (oup.indexOf('+') != -1) {
oup=oup.replace('+','');
}
while (oup.indexOf(' ') != -1) {
oup=oup.replace(' ','');
}
if (oup.indexOf(';') != -1) {
var ous=oup.split(';');
oup=ous[eval(-1 + ous.length)];
if (ous[0].indexOf(',') != -1) {
var ouss=ous[0].split(',');
vwidth=eval(ouss[0].replace('[','').replace(']',''));
vheight=eval(ouss[1].replace('[','').replace(']',''));
if (vwidth != 640 || vheight != 390) hone=0;
} else {
vwidth=eval(ous[0].replace('[','').replace(']',''));
if (ous.length >= 3) vheight=eval(ous[1].replace('[','').replace(']',''));
if (vwidth != 640 || vheight != 390) hone=0;
}
}
if (iframegridmode) {
oup=iframemode(oup);
}
return oup;
}
function offerform() {
offerdform(hm);
}
function offerdform(howmany) {
var iid="id=i2 onblur=\"document.getElementById('vid').value=this.value;\"";
var odivc="<form id='oform' target='_self' action='./stop_start_youtube.html' method='GET'><input type='hidden' value='2' name='this'></input><input type='hidden' value='-1' name='playtime'></input><input type='hidden' value='" + vidarr[0] + "' id='vid' name='vid'></input><input id='bsubmit' type='submit' value='Play' style='display:none;'></input><br>Current Video Playing 1 of " + howmany + " <input type='text' readonly value='" + vid + "' name='next'></input> ... and then ...";
for (var ij=2; ij<=howmany; ij++) {
odivc+="<br>Video to Play Later " + ij + " of " + howmany + " <input " + iid + " type='text' value='" + vidarr[eval(-1 + ij)] + "' name='next" + ij + "'></input>";
iid='';
}
odivc+="</form>";
document.getElementById('dform').innerHTML = odivc;
tobechecked=document.getElementById('i2');
}
function updatesc() {
cnt+=one;
cntpause+=onepause;
if (toggle == 0) secscnt+=one;
var ours="00" + eval(secscnt % 60);
var ourm="00" + eval((secscnt - ours) / 60);
suffix="#t=" + ourm.substring(eval(ourm.length - 2)) + "m" + ours.substring(eval(ours.length - 2)) + "s";
if (presuffix != "") presuffix=suffix;
if (eval(eval(cnt) - eval(cntpause)) >= duration && eval(duration) > 0) { // && eval(playtime) < 0) {
if (tobechecked != null) {
if (tobechecked.value != '') {
document.getElementById('oform').submit();
}
} else if (nexturl != '') {
if (urlis == '') location.href=nexturl;
} else {
secscnt=cnt;
stopVideo();
}
}
}
function followup() {
var lb='', ilb=2, prevtext=' ';
if (kpi == -9) {
//alert(99);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(990);
//parent.document.getElementById('myh1').innerHTML='zxkpi' + document.URL;
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(9900);
kpi=-8;
kpi=0; //player.getCurrentTime();
setTimeout(keepParentInformed,1000);
}
}
}
thistext=location.search.split('this=')[1] ? location.search.split('this=')[1].split('&')[0] : '';
if (thistext != '') {
of = ' ' + thistext + ' of ';
nexttext=eval(1 + eval(thistext));
if (nexttext >= 2) prevtext=eval(-1 + eval(thistext));
if (("" + prevtext) == "1") prevtext="";
} else if (document.URL.indexOf('next2=') != -1) {
of = ' 1 of ';
nexttext=2;
}
nextvid=location.search.split('next' + nexttext + '=')[1] ? location.search.split('next' + nexttext + '=')[1].split('&')[0] : '';
if (nextvid != '') {
//alert(nextvid + " " + 'vid=' + vid + " NEWvid=" + nextvid + " " + document.URL);
nexturl=document.URL.replace('this=' + thistext + '&', 'this=' + nexttext + '&').replace('vid=' + vid + play_list_id, 'vid=' + nextvid);
//alert(nexturl);
}
if (prevtext != ' ') {
prevvid=location.search.split('next' + prevtext + '=')[1] ? location.search.split('next' + prevtext + '=')[1].split('&')[0] : '';
if (prevvid != '') {
prevurl=document.URL.replace('this=' + thistext + '&', 'this=' + prevtext + '&').replace('vid=' + vid + play_list_id, 'vid=' + prevvid);
}
}
//alert(nexttext + '=nexttext nextvid=' + nextvid + ' nexturl=' + nexturl);
if (document.URL.indexOf('next2=') != -1) {
while (document.URL.indexOf('next' + ilb + '=') != -1) {
ilb++;
}
lb=eval(ilb - 1);
of+=lb + ' ';
}
}
function analyzemaybe(playing, paused, isdone) {
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
if (paused != 0) {
var urp=parent.document.getElementById('updatethisplease');
if (urp) {
if (urp.value != '') {
var urpvalue=urp.value;
parent.document.getElementById(urpvalue).value=player.getCurrentTime();
if (urpvalue.indexOf('i') == 0) {
urpvalue=urpvalue.replace('i','j');
parent.document.getElementById('updatethisplease').value=urpvalue;
} else {
urpvalue=urpvalue.replace('j','');
urpvalue=eval(1 + eval(urpvalue));
urpvalue='i' + urpvalue;
if (parent.document.getElementById(urpvalue).value == "") {
parent.document.getElementById(urpvalue.replace('i','c')).checked=true;
}
parent.document.getElementById('updatethisplease').value=urpvalue;
}
//alert(urpvalue);
}
}
}
}
}
}
</script>
</head>
<body onload=' followup(); setInterval(updatesc,1000);' style='background-color: lightgreen;'>
<form id='fgrid' method='POST' target='_self' action='http://www.rjmprogramming.com.au/HTMLCSS/reveal_div.php'>
<input style='display:none' type='submit' value='Show in Grid' id='bgrid'></input>
<input type='hidden' value='' id='p1' name='p1'></input>
<input type='hidden' value='' id='p2' name='p2'></input>
<input type='hidden' value='' id='p3' name='p3'></input>
<input type='hidden' value='' id='p4' name='p4'></input>
<input type='hidden' value='' id='p5' name='p5'></input>
<input type='hidden' value='' id='p6' name='p6'></input>
<input type='hidden' value='' id='p7' name='p7'></input>
<input type='hidden' value='' id='p8' name='p8'></input>
<input type='hidden' value='' id='p9' name='p9'></input>
</form>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player"></div>
<script>
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
vwidth=location.search.split('width=')[1] ? eval(location.search.split('width=')[1].split('&')[0]) : vwidth;
vheight=location.search.split('height=')[1] ? eval(location.search.split('height=')[1].split('&')[0]) : vheight;
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
//var player;
if (document.URL.indexOf('vid=') != -1) {
vid=location.search.split('vid=')[1] ? location.search.split('vid=')[1].split('&')[0] : postprompt(prompt('Please enter YouTube video id or playlist id (or a comma separated list of these, that can include a + to have up to 18 of them occur in a parent iframe grid), and optionally prefix by [640;][390;] which is [width;][height;]', previd));
vidarr=vid.split(',');
var splaytime="";
if (vid.indexOf(',') != -1) {
vid=vidarr[0];
splaytime=eval(-vidarr.length);
} else if (urlis != '' && document.URL.indexOf('playtime=') == -1) {
//location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=-1000';
splaytime="-1";
oknow=false;
setTimeout(sendoff,2000);
} else if (vid.length > ('cGdz3GNhEQ4').length && document.URL.indexOf('playtime=') == -1) {
if (urlis == '') location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=-1000';
splaytime="-1";
oknow=false;
} else if (document.URL.indexOf('start=') != -1) {
splaytime=location.search.split('playtime=')[1] ? eval(1000.0 * eval(location.search.split('playtime=')[1].split('&')[0])) : prompt('Please enter YouTube video ' + vid + ' playtime snippets in seconds (-1 to play whole video in one session, -2 (or -n) to play whole video and perhaps more (n in total) to follow in one session)', playtime / 1000);
} else {
splaytime=location.search.split('playtime=')[1] ? location.search.split('playtime=')[1].split('&')[0] : prompt('Please enter YouTube video ' + vid + ' playtime snippets in seconds (-1 to play whole video in one session, -2 (or -n) to play whole video and perhaps more (n in total) to follow in one session)', playtime / 1000);
}
if (document.URL.indexOf('playtime=') != -1) {
playtime=eval(eval("" + splaytime) * 1);
} else if (("" + splaytime) != "-1" && ("" + splaytime).indexOf("-") == 0) {
playtime=eval(-1 * 1000);
hm=eval(("" + splaytime).replace('-',''))
of=' 1 of up to ' + hm + ' ';
if (oknow) setTimeout(offerform,2000);
} else {
playtime=eval(eval("" + splaytime) * 1000);
}
} else {
vid=location.search.split('vid=')[1] ? location.search.split('vid=')[1].split('&')[0] : postprompt(prompt('Please enter YouTube video id or playlist id (or a comma separated list of these, that can include a + to have up to 18 of them occur in a parent iframe grid), and optionally prefix by [640;][390;] which is [width;][height;]', previd));
vidarr=vid.split(',');
var ssplaytime="";
if (vid.indexOf(',') != -1) {
vid=vidarr[0];
ssplaytime=eval(-vidarr.length);
} else if (urlis != '' && document.URL.indexOf('playtime=') == -1) {
//location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=-1000';
ssplaytime="-1";
oknow=false;
setTimeout(sendoff,2000);
} else if (vid.length > ('cGdz3GNhEQ4').length && document.URL.indexOf('playtime=') == -1) {
if (urlis == '') location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=-1000';
ssplaytime="-1";
oknow=false;
} else {
ssplaytime=location.search.split('playtime=')[1] ? location.search.split('playtime=')[1].split('&')[0] : prompt('Please enter YouTube video ' + vid + ' playtime snippets in seconds (-1 to play whole video in one session, -2 (or -n) to play whole video and perhaps more (n in total) to follow in one session)', playtime / 1000);
}
if (document.URL.indexOf('playtime=') != -1) {
playtime=eval(eval("" + ssplaytime) * 1);
} else if (("" + ssplaytime) != "-1" && ("" + ssplaytime).indexOf("-") == 0) {
playtime=eval(-1 * 1000);
hm=eval(("" + ssplaytime).replace('-',''))
if (hm > hone) {
anymore='&this=&width=' + vwidth + '&height=' + vheight + '&next=' + vid;
for (var iu=2; iu<=hm; iu++) {
anymore+='&next' + iu + '=' + vidarr[eval(-1 + iu)];
}
}
of=' 1 of up to ' + hm + ' ';
//alert(vid + " " + ssplaytime + " " + ("" + ssplaytime).indexOf("-") + " " + hm);
if (oknow) setTimeout(offerform,2000);
} else if (hone == 0) {
anymore='&this=&width=' + vwidth + '&height=' + vheight + '&next=' + vid;
playtime=eval(eval("" + ssplaytime) * 1000);
} else {
playtime=eval(eval("" + ssplaytime) * 1000);
}
if (urlis == '' && ((vid != previd && vid.indexOf(',') == -1) || vwidth != 640 || vheight != 390)) location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=' + playtime + anymore;
}
function onYouTubeIframeAPIReady() {
if (vid.length > ('cGdz3GNhEQ4').length) {
play_list_id=vid;
vid='';
player = new YT.Player('player', {
width: vwidth,
height: vheight,
playerVars:
{
listType: 'playlist',
list: play_list_id,
index: 0
},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
//player.playVideoAt(0);
} else {
player = new YT.Player('player', {
height: vheight,
width: vwidth,
videoId: vid,
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
event.target.playVideo();
toggle=eval(1 - toggle);
if (play_list_id != '' && play_list_id.length > ('cGdz3GNhEQ4').length && document.URL.indexOf('playtime=') != -1) {
//window.open('./stop_start_youtube.html','_blank');
//location.href=player.getVideoUrl();
var yturlis=player.getVideoUrl();
if (document.URL.indexOf('nowo=') == -1 && urlis == '') window.open(yturlis,'_blank','top=50,left=650,width=700,height=800');
}
}
// 5. The API calls this function when the player's state changes.
// The function indicates that when playing a video (state=1),
// the player should play for six seconds and then stop.
var done = false;
function onPlayerStateChange(event) {
one=0;
onepause=0;
if (event.data == YT.PlayerState.PLAYING) one=1;
if (event.data == YT.PlayerState.PAUSED) onepause=1;
analyzemaybe(one, onepause, done);
if (event.data == YT.PlayerState.PLAYING && !done) {
duration=player.getDuration();
if (document.URL.indexOf('start=0') != -1 && document.URL.indexOf('playtime=0') != -1) {
//alert(duration);
oursecscnt=-1;
setTimeout(stopVideo, 10);
parent.document.getElementById('youtube_duration').value='' + duration;
parent.document.getElementById('myh1').innerHTML=player.getVideoData().title;
if (kpi == -9) {
//alert(99);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(990);
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(9900);
kpi=-8;
kpi=player.getCurrentTime();
keepParentInformed();
}
}
}
//stopVideo();
return;
} else {
if (playtime < 0) playtime=duration * 1000;
document.title='Playing YouTube ' + vid + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.';
document.getElementById('ptitle').innerHTML='Playing YouTube ' + vid + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.' + etc_volume();
document.getElementById('ivol').value=player.getVolume();
document.getElementById('ipbr').value=player.getPlaybackRate();
document.getElementById('iqty').value=player.getPlaybackQuality();
setTimeout(stopVideo, playtime + delay);
done = true;
eventtarget=event.target;
if (eval(oursecscnt) > 0) {
document.getElementById('ptitle').innerHTML='Playing YouTube ' + vid + ' starting at ' + oursecscnt + ' seconds ' + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.' + etc_volume();
document.title='Playing YouTube ' + vid + ' starting at ' + oursecscnt + ' seconds ' + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.';
if (kpi == -9) {
//alert(909);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(90900);
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(909000);
kpi=-8;
kpi=player.getCurrentTime();
//alert(kpi);
keepParentInformed();
}
}
}
eventtarget.loadVideoById(vid, eval(oursecscnt), eval(oursecscnt + playtime / 1000), "medium");
//alert("+" + oursecscnt);
oursecscnt=-1;
}
}
}
}
function keepParentInformed() {
if (eval(kpi) < 0) {
parent.document.getElementById('conduit').value=kpi;
} else {
var xkpi=player.getCurrentTime();
//top.document.title=xkpi;
if (('' + xkpi).indexOf('undefined') == -1) kpi=eval(xkpi);
parent.document.getElementById('conduit').value=kpi;
//parent.document.getElementById('myh1').innerHTML+=' ' + kpi;
}
if (eval(kpi) != -1) {
//alert(kpi);
setTimeout(keepParentInformed, 600);
} //else {
//alert('why is kpi=' + kpi);
//}
}
function stopVideo() {
if (cntpause > 0) {
setTimeout(stopVideo, cntpause * 1000);
cntpause=0;
} else {
var dorest=true;
toggle=1;
secscnt=player.getCurrentTime();
duration=player.getDuration();
//alert('preone' + playtime);
if (playtime < 0) playtime=duration * 1000;
//alert('Preone' + dorest);
player.stopVideo();
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(secscnt);
kpi=-1;
keepParentInformed();
}
}
if (eval(oursecscnt) < 0) { // new Karaoke ideas in this "if"
//alert(9);
secscnt = duration;
tobechecked=null;
dorest=false;
}
//alert(secscnt);
if (secscnt >= duration) {
if (tobechecked != null) {
if (tobechecked.value != '') {
dorest=false;
document.getElementById('oform').submit();
//document.getElementById('bsubmit').click();
}
}
if (dorest) {
if (nexturl != "") {
if (urlis == '') location.href=nexturl;
} else if ('old' == 'new') {
if (document.URL.indexOf('nowo=') == -1 && document.URL.indexOf('start=') == -1) alert("Stumps has been called. End of play.");
} else if (dostumps && document.URL.indexOf('nowo=') == -1) {
dostumps=false;
var donext=null;
if (document.URL.indexOf('start=') == -1) prompt("Stumps has been called. End of play. Is there a YouTube video id to play next?", "");
if (donext == null) donext='';
if (donext != '' && urlis == '') location.href='./stop_start_youtube.html?vid=' + donext;
}
}
} else {
setTimeout(startVideo, playtime + delay);
}
}
}
function startVideo() {
var dorest=true;
//alert('PREone ' + secscnt + ' ' + duration + ':' + dorest);
if (secscnt >= duration) {
if (tobechecked != null) {
if (tobechecked.value != '') {
dorest=false;
document.getElementById('oform').submit();
//document.getElementById('bsubmit').click();
}
}
if (dorest) {
if (nexturl != "") {
if (urlis == '') location.href=nexturl;
} else if ('old' == 'new') {
if (document.URL.indexOf('nowo=') == -1) alert("Stumps is called. End of play.");
} else if (dostumps && document.URL.indexOf('nowo=') == -1) {
dostumps=false;
var donext=prompt("Stumps is called. End of play. Is there a YouTube video id to play next?", "");
if (donext == null) donext='';
if (donext != '' && urlis == '') location.href='./stop_start_youtube.html?vid=' + donext;
}
}
} else {
//alert('two');
if (document.URL.indexOf('start=0') != -1 && document.URL.indexOf('playtime=0') != -1) {
//alert('+' + duration);
oursecscnt=-1;
setTimeout(stopVideo, 10);
parent.document.getElementById('youtube_duration').value='' + duration;
parent.document.getElementById('myh1').innerHTML=player.getVideoData().title;
if (kpi == -9) {
//alert(99000);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(990000);
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(9900000);
kpi=-8;
kpi=player.getCurrentTime();
keepParentInformed();
}
}
}
//stopVideo();
return;
} else {
document.title='Playing YouTube ' + vid + ' starting at ' + secscnt + ' seconds to ' + Math.min(duration, eval(secscnt + (playtime / 1000))) + ' seconds for up to ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.';
document.getElementById('ptitle').innerHTML='Playing YouTube ' + vid + ' starting at ' + secscnt + ' seconds to ' + Math.min(duration, eval(secscnt + (playtime / 1000))) + ' seconds for up to ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.' + etc_volume();
document.getElementById('ivol').value=player.getVolume();
document.getElementById('ipbr').value=player.getPlaybackRate();
document.getElementById('iqty').value=player.getPlaybackQuality();
eventtarget.cueVideoById(vid, secscnt, secscnt + playtime / 1000, "medium");
if (eval(oursecscnt) > 0) {
//alert(oursecscnt);
document.getElementById('ptitle').innerHTML='Playing YouTube ' + vid + ' starting at ' + oursecscnt + ' seconds to ' + Math.min(duration, eval(secscnt + (playtime / 1000))) + ' seconds for up to ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.' + etc_volume();
document.title='Playing YouTube ' + vid + ' starting at ' + oursecscnt + ' seconds ' + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.';
if (kpi == -9) {
//alert(909);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(9090);
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(90900);
kpi=-8;
kpi=player.getCurrentTime();
//alert(kpi + ".");
keepParentInformed();
}
}
}
eventtarget.loadVideoById(vid, eval(oursecscnt), eval(oursecscnt + playtime / 1000), "medium");
oursecscnt=-1;
}
toggle=0;
player.playVideo();
setTimeout(stopVideo, playtime + delay);
}
}
}
</script>
<h1 style='align:right;'>YouTube Embedded Iframe API Usage</h1>
<h3 style='align:right;'>RJM Programming - June, 2016</h3>
<div id='ptitle'></div>
<div id='dform' style='background-color:yellow;'></div>
</body>
</html>