<!doctype HTML>
<html>
<head>
<title>Play Audio and/or Video on Major Browsers - RJM Programming - October, 2014</title>
<script type='text/javascript'>
var ais = location.search.split('afilename=')[1] ? location.search.split('afilename=')[1].split('&')[0] : '';
var vis = location.search.split('vfilename=')[1] ? location.search.split('vfilename=')[1].split('&')[0] : '';
var ats = location.search.split('atype=')[1] ? location.search.split('atype=')[1].split('&')[0] : '';
var vts = location.search.split('vtype=')[1] ? location.search.split('vtype=')[1].split('&')[0] : '';
function presstn() {
var iv=document.getElementById('ivideo');
var ia = document.getElementById("iaudio");
iv.src = "./video_generic.php?filename=Nala_HideAndSeek";
ia.src = "./audio_generic.php?filename=Thunder_Mike_Koenig_315681025";
}
function pressdbeg() {
var iv=document.getElementById('ivideo');
var ia = document.getElementById("iaudio");
//iv.src = "./video_generic.php?filename=Loveatfirstbite.jpg&path=&domain=http://www.rjmprogramming.com.au/TESOL/ListeningTask2/";
iv.src = "http://www.rjmprogramming.com.au/TESOL/ListeningTask2/Loveatfirstbite.jpg";
ia.src = "./audio_generic.php?filename=Love_at_first_bite.ogg&path=&domain=http://www.rjmprogramming.com.au/TESOL/ListeningTask2/";
}
function pressnc() {
var iv=document.getElementById('ivideo');
var ia = document.getElementById("iaudio");
//iv.src = "./video_generic.php?filename=Nala_Catch";
//ia.src = "./audio_generic.php?filename=Nala_Catch";
ia.src = "http://www.rjmprogramming.com.au/PHP/Nala_Catch.m4v";
iv.src = "http://www.rjmprogramming.com.au/PHP/Nala_Catch.mov";
}
function presswn() {
var iv=document.getElementById('ivideo');
var ia = document.getElementById("iaudio");
iv.src = "./video_generic.php?filename=Nala_HideAndSeek";
ia.src = "./audio_generic.php?filename=Wind-SoundBible";
}
function pressboth(ihuh) {
//alert(999);
if (ais.length <= 0 && vis.length <= 0 && ihuh > 0) return "";
var ok="", oka="";
var iv=document.getElementById('ivideo');
var yiv = (iv.contentWindow || iv.contentDocument);
var ia = document.getElementById("iaudio");
var yia = (ia.contentWindow || ia.contentDocument);
if (yia.document) yia = yia.document;
if (yiv.document) yiv = yiv.document;
var bia=yia.getElementById('submit');
var biv=yiv.getElementById('submit');
if (bia == null && biv != null) {
if (ia.src.indexOf("?") == -1) {
ia.src = ia.src + "?s=s";
} else if (ia.src.indexOf("&") == -1) {
ia.src = ia.src + "&ss=ss";
} else if (ia.src.indexOf("&ss=ss") != -1) {
ia.src = ia.src + "1";
} else {
ia.src = ia.src + "&ss=sss";
}
yia = yiv;
ia = iv;
}
if (bia != null && biv == null) {
if (iv.src.indexOf("?") == -1) {
iv.src = iv.src + "?s=s";
} else if (iv.src.indexOf("&") == -1) {
iv.src = iv.src + "&ss=ss";
} else if (iv.src.indexOf("&ss=ss") != -1) {
iv.src = iv.src + "1";
} else {
iv.src = iv.src + "&ss=sss";
}
yiv = yia;
iv = ia;
}
if (bia == null && biv == null) {
if (ia.src.indexOf("?") == -1) {
ia.src = ia.src + "?s=s";
} else if (ia.src.indexOf("&") == -1) {
ia.src = ia.src + "&ss=ss";
} else if (ia.src.indexOf("&ss=ss") != -1) {
ia.src = ia.src + "1";
} else {
ia.src = ia.src + "&ss=sss";
}
if (iv.src.indexOf("?") == -1) {
iv.src = iv.src + "?s=s";
} else if (iv.src.indexOf("&") == -1) {
iv.src = iv.src + "&ss=ss";
} else if (iv.src.indexOf("&ss=ss") != -1) {
iv.src = iv.src + "1";
} else {
iv.src = iv.src + "&ss=sss";
}
} else {
if (ais.length > 0 && vis.length > 0) {
yia.getElementById("bloop").value = "";
yiv.getElementById("bloop").value = "";
yia.getElementById("loop").value = "";
yiv.getElementById("loop").value = "";
yia.getElementById("path").value = "";
yiv.getElementById("path").value = "";
var afis=ais.split("/");
var afiss=afis[afis.length - 1].split(".");
var ua = navigator.userAgent;
var isSafari = false;
if (ua.indexOf("Safari") != -1) isSafari = true;
if (isSafari && afis[afis.length - 1].replace(".mpeg","") != afis[afis.length - 1]) {
oka="y";
ia.src = ais;
} else if (ats.indexOf("image/") != -1 || afis[afis.length - 1].replace(".ogv","") != afis[afis.length - 1]) {
oka="y";
ia.src = ais;
} else {
yia.getElementById("filename").value = afis[afis.length - 1]; //afiss[0];
yia.getElementById("domain").value = ais.replace(afis[afis.length - 1],"");
//alert(9973);
if (ats != "") {
yia.getElementById("mimetype").value = ats;
}
}
var vfis=vis.split("/");
var vfiss=vfis[vfis.length - 1].split(".");
//alert(9974);
if (vts.indexOf("image/") != -1 || vfis[vfis.length - 1].replace(".ogv","") != vfis[vfis.length - 1] || vfis[vfis.length - 1].replace(".mp","") != vfis[vfis.length - 1]) {
ok="y";
iv.src = vis;
} else {
yiv.getElementById("filename").value = vfis[vfis.length - 1]; //vfiss[0];
yiv.getElementById("domain").value = vis.replace(vfis[vfis.length - 1],"");
//alert(996);
if (vts != "") {
yiv.getElementById("mimetype").value = vts;
}
}
}
//alert(995);
if (ok != "y" && biv != null) biv.click();
if (oka != "y" && bia != null) bia.click();
//alert(994);
}
return "";
}
</script>
</head>
<body onload=" pressboth(1); ">
<table style="width:100%;">
<tr><th><input type='button' onclick='document.getElementById("iaudio").src="./audio_generic.php";' value='Audio'</input></th><th><input type='button' onclick=' if (ais != "") { location.href="./audio_video.php?s=s"; } else { document.getElementById("iaudio").src="./audio_generic.php"; document.getElementById("ivideo").src="./video_generic.php"; } ' value='-'></input></th><th><input type='button' onclick='document.getElementById("ivideo").src="./video_generic.php";' value='Video'></input></th></tr>
<tr><td style=width:40%;><iframe width='100%' height='900px' id='iaudio' name='naudio' src='./audio_generic.php'></iframe></td><td align='center' style=width:4%;><input align='center' onclick='pressboth(0); return false;' type='button' name='submit' id='submit' value='Synchronize Play' title='Play both audio and video together'></input><br><br><input align='center' onclick='presswn(); return false;' type='button' name='submitwn' id='submitwn' value='Windy Nala' title='Audio thanks to http://soundbible.com'></input><br><input align='center' onclick='presstn(); return false;' type='button' name='submittn' id='submittn' value='Stormy Nala' title='Audio thanks to http://soundbible.com'></input><br><input align='center' onclick='pressnc(); return false;' type='button' name='submitnc' id='submitnc' value='Nala Catch'></input><br><input align='center' onclick='pressdbeg(); return false;' type='button' name='submitdbeg' id='submitdbeg' value='Love at First Bite'></input></td><td style=width:40%;><iframe width='100%' height='900px' id='ivideo' name='nvideo' src='./video_generic.php'></iframe></td></tr>
</table>
</body>
</html>