<?php
 // Record yourself via ffmpeg and MAMP on local system
 // RJM Programming
 // December, 2025
 // Use ffmpeg avfoundation
 // Thanks to https://www.google.com/search?q=macos+audio+recording+via+command+line&rlz=1C5OZZY_en&oq=macos+audio+recording+via+command+line&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIHCAEQIRigATIHCAIQIRigAdIBCTE0ODk2ajBqN6gCALACAA&sourceid=chrome&ie=UTF-8 and https://www.google.com/search?q=ffmpeg+avfoundation+does+not+work+on+windows&rlz=1C5OZZY_en&oq=ffmpeg+avfoundation+does+not+work+on+windows&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIHCAEQIRigATIHCAIQIRigAdIBCTE0NTg0ajBqN6gCALACAA&sourceid=chrome&ie=UTF-8 and https://www.google.com/search?q=windows+taskkill+after+a+specified+time&oq=windows+taskkill+after+a+specified+time&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTE4NDM5ajBqN6gCALACAA&sourceid=chrome&ie=UTF-8
 // ffmpeg -f avfoundation -t 10 -i "1:0" -r 30 output.mp4
  
 $cameratype="";
 $datap="data";
 $one="";
 $ext=".m4a";
 $mtype="audio";
 $mimetype="audio/mp4";
 $mswitch=" -c:a aac ";
 $fpath="";
 $period="10";
 $isvideo="false";
 $wds="\\";
 $res="";
 $altn=0;
 $altv="";
 $alta="";
 if (isset($_GET['period'])) {
   $period=str_replace('+',' ',urldecode($_GET['period']));
 } else if (isset($_POST['period'])) {
   $period=str_replace('+',' ',urldecode($_POST['period']));
 }
 if (isset($_GET['video'])) {
   if (strlen($_GET['video']) > 0) {
   $cameratype=$_GET['video'];
   if ($cameratype == "s") {
     if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "dshow_va.txt")) {
      $fp = fopen($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "dshow_va.txt", 'r');
      $dshowc=fread($fp, filesize($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "dshow_va.txt"));
      fclose($fp);
      $altn=sizeof(explode('Alternative name "', $dshowc));
      if ($altn >= 3) {
        $altv=explode('"', explode('Alternative name "', $dshowc)[1])[0];
        $alta=explode('"', explode('Alternative name "', $dshowc)[2])[0];
      }
     }
     if ($altv == "" || $alta == "") {
      $cameratype="y";
     }
   }
   $datap="atad";
   $isvideo="true";
   $one="1";
   $ext=".mp4";
   $mtype="video";
   $mimetype="video/mp4";
   $mswitch=" -r 30 ";
   }
 } else if (isset($_POST['video'])) {
   if (strlen($_POST['video']) > 0) {
   $cameratype=$_POST['video'];
   if ($cameratype == "s") {
     if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "dshow_va.txt")) {
      $fp = fopen($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "dshow_va.txt", 'r');
      $dshowc=fread($fp, filesize($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "dshow_va.txt"));
      fclose($fp);
      $altn=sizeof(explode('Alternative name "', $dshowc));
      if ($altn >= 3) {
        $altv=explode('"', explode('Alternative name "', $dshowc)[1])[0];
        $alta=explode('"', explode('Alternative name "', $dshowc)[2])[0];
      }
     }
     if ($altv == "" || $alta == "") {
      $cameratype="y";
     }
   }
   $datap="atad";
   $isvideo="true";
   $one="1";
   $ext=".mp4";
   $mtype="video";
   $mimetype="video/mp4";
   $mswitch=" -r 30 ";
   }
 }
 if (trim($period) == '') { $period="10"; }
 file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording.y", "y");
 $verb="ffmpeg -f avfoundation -i " . $one . ":0 -t " . $period . $mswitch . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext . " < " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording.y ; open http://localhost:8888/mic_recording" . $ext;
 if (isset($_GET['verb'])) {
   $verb=str_replace('+',' ',urldecode($_GET['verb']));
 } else if (isset($_POST['verb'])) {
   $verb=str_replace('+',' ',urldecode($_POST['verb']));
 }
 if (PHP_OS == 'Darwin') {
  if (trim($verb) == '') { $verb="ffmpeg -f avfoundation -i " . $one . ":0 -t " . $period . $mswitch . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext . " < " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording.y ; open http://localhost:8888/mic_recording" . $ext; }
  if (file_exists(DIRECTORY_SEPARATOR . 'usr' . DIRECTORY_SEPARATOR . 'local' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'ffmpeg')) {
   if (strpos((' ' . $verb  . ' '), ' ffmpeg ') !== false) {
    $verb=str_replace('ffmpeg', DIRECTORY_SEPARATOR . 'usr' . DIRECTORY_SEPARATOR . 'local' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'ffmpeg', $verb);
   }
  } else if (file_exists(DIRECTORY_SEPARATOR . 'usr' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'ffmpeg')) {
   if (strpos((' ' . $verb  . ' '), ' ffmpeg ') !== false) {
    $verb=str_replace('ffmpeg', DIRECTORY_SEPARATOR . 'usr' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'ffmpeg', $verb);
   }
  }
  if (strpos($verb, ' -') === false) {
    if (isset($_GET['passthru']) || isset($_POST['passthru'])) {
    if (strpos(('~' . $verb . ' '), '~say ') !== false) {
    exec(str_replace('saJUNKy ','say -i --progress ',$verb));
    exit;
    } else {
    passthru("osascript -e 'tell application \"Terminal\" to do script \"" . $verb . "\"'");
    }
    } else {
    $res=passthru("osascript -e 'tell application \"Terminal\" to do script \"" . $verb . "\"'");
    echo "<html><head><meta charset='UTF-8'/></head><body><p title='This is in your clipboard now.' style='font-family:courier new;'>" . str_replace(" ", "&nbsp;", str_replace("\t", "&#9;", str_replace("\n","<br>",$res))) . "</p></body></html>";
    }
  } else if (isset($_GET['passthru']) || isset($_POST['passthru'])) {
    if (strpos(('~' . $verb . ' '), '~say ') !== false) {
    passthru("osascript -e 'tell application \"Terminal\" to do script \"" . $verb . "\"'");
    exit;
    } else {
    passthru("osascript -e 'tell application \"Terminal\" to do script \"" . $verb . "\"'");
    }
  } else {
    $res=shell_exec("osascript -e 'tell application \"Terminal\" to do script \"" . $verb . "\"'");
    sleep(5);
    sleep($period);
    $spare='data:' . $mimetype . ';base64,' . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext));
    shell_exec("echo 'data:" . $mimetype . ";base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext)) . "' | pbcopy");
    echo "<p title='This is your " . $mtype . " recording.' style='font-family:courier new;'>" . str_replace(" ", "&nbsp;", str_replace("\t", "&#9;", str_replace("\n","<br>",$verb))) . "</p><br><a target=_top href='mailto:?subject=My%20" . $mtype . "%20recording&body=" . urlencode('https://www.rjmprogramming.com.au/recording_ideas.php#' . $datap) . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext)) . "'>Email " . $mtype . " recording to someone</a><br><br><" . $mtype . " controls><source type=" . $mimetype . " src='data:" . $mimetype . ";base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext)) . "'></source></" . $mtype . "><br><br><br><textarea title='Data URI of the captured " . $mtype . " ... is currently copied into your clipboard' style=width:98%;height:500px;>data:" . $mimetype . ";base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext)) . "'></textarea>";
  }
 } else if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') {
  $datap="atad";
  $isvideo="true";
  $one="1";
  $ext=".mp4";
  $mtype="video";
  $mimetype="video/mp4";
  $mswitch=" -f gdigrab -framerate 30 -i desktop ";
  if (trim($verb) == '') {
    if ($cameratype == "s") {
      $verb="ffmpeg -f dshow -rtbufsize 2125M -framerate 30 -i video=\"" . $altv . "\":audio=\"" . $alta . "\" -t " . $period . ' -c:a aac ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext . " < " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording.y 2> " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording.err"; // . " & explorer.exe http://localhost/mic_recording" . $ext;
      if (file_exists(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bbt')) {
      unlink(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bbt');
     }
      $fp = fopen(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bbt', 'x');
      fwrite($fp, $verb . ' ... ' . $_SERVER['QUERY_STRING'] . "\ntimeout /t " . $period . " /nobreak > nul\ntaskkill /IM ffmpeg.exe /F\n" . "if exist " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bat' . " erase " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bat' . "\nexit");
      fclose($fp);
      if (file_exists(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bzt')) {
      unlink(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bzt');
     }
      //$fp = fopen(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bzt', 'x');
      //fwrite($fp, "timeout /t " . $period . " /nobreak > nul\ntaskkill /IM ffmpeg.exe /F\n" . "if exist " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bat' . " erase " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'stop_extravaganza.bat' . "\nexit");
      //fclose($fp);
    } else {
      $verb="ffmpeg -f gdigrab -framerate 30 -i desktop -t " . $period . ' ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext . " < " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording.y 2> " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording.err"; // . " & explorer.exe http://localhost/mic_recording" . $ext;
    }
  }
  $ffmpegcommand="C:\\PROGRA~1\\IMAGEM~1.0-Q\\";
  if (file_exists($ffmpegcommand . "ffmpeg.exe")) {
   $ffmpegcommand.="ffmpeg.exe";
   if (strpos((' ' . $verb  . ' '), ' ffmpeg ') !== false) {
    $verb=str_replace('ffmpeg', $ffmpegcommand, $verb);
   }
  } else {
   $ffmpegcommand="";
  }
  if (strpos($verb, ' -') !== false) {
    if (isset($_GET['passthru']) || isset($_POST['passthru'])) {
    if (strpos(('~' . $verb . ' '), '~say ') !== false) {
    exec(str_replace('saJUNKy ','say -i --progress ',$verb));
    exit;
    } else {
    passthru($verb);
    }
    } else {
    //$res=shell_exec($verb);
    if (file_exists(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bxt')) {
    unlink(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bxt');
    }
    $fp = fopen(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bxt', 'x');
    fwrite($fp, str_replace(" & ", "\n", str_replace(" ; ", "\n", $verb)) . "\nerase " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat');
    fclose($fp);
    $fp = fopen(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bbt', 'x');
    fwrite($fp, str_replace(" ; ", "\n", $verb) . "\nerase " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat');
    fclose($fp);
    sleep(65);
    sleep($period);
    //shell_exec("echo 'data:" . $mimetype . ";base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext)) . "' | clip");
    $fp = fopen($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext, 'r');
    $fgc=fread($fp, filesize($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "mic_recording" . $ext));
    fclose($fp);
    $verbtwo=("echo 'data:" . $mimetype . ";base64," . base64_encode($fgc) . "' | clip");
    $spare='data:' . $mimetype . ';base64,' . base64_encode($fgc);
    $fp = fopen(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bxt', 'x');
    fwrite($fp, str_replace(" ; ", "\n", $verbtwo) . "\nerase " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat');
    fclose($fp);
    $fp = fopen(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bbt', 'x');
    fwrite($fp, str_replace(" ; ", "\n", $verbtwo) . "\nerase " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat');
    fclose($fp);
    echo "<html><head><scr" . "ipt type=text/javascript> var qq='\"\"'; </scr" , "ipt></head><body><p title='This is your " . $mtype . " recording.' style='font-family:courier new;'>" . str_replace(" ", "&nbsp;", str_replace("\t", "&#9;", str_replace("\n","<br>",$verb))) . "</p><br><a target=_top href='mailto:?subject=My%20" . $mtype . "%20recording&body=" . urlencode('https://www.rjmprogramming.com.au/recording_ideas.php#' . $datap) . base64_encode($fgc) . "'>Email " . $mtype . " recording to someone</a><br><br><" . $mtype . " controls><source type=" . $mimetype . " src='data:" . $mimetype . ";base64," . base64_encode($fgc) . "'></source></" . $mtype . "><br><br><br><textarea title='Data URI of the captured " . $mtype . " ... is currently copied into your clipboard' style=width:98%;height:500px;>data:" . $mimetype . ";base64," . base64_encode($fgc) . "'></textarea></body></html>";
    }
  } else if (isset($_GET['passthru']) || isset($_POST['passthru'])) {
    if (strpos(('~' . $verb . ' '), '~say ') !== false) {
    exec($verb);
    exit;
    } else {
    passthru($verb);
    }
  } else {
    $res=shell_exec($verb);
    echo "<p title='This is your " . $mtype . " recording.' style='font-family:courier new;'>" . str_replace(" ", "&nbsp;", str_replace("\t", "&#9;", str_replace("\n","<br>",$res))) . "</p>";
  }
 } else {
  //echo shell_exec($verb . " | pbcopy; pbpaste");
  echo "<html>
<head>
<meta charset='UTF-8'/>
<title>Record yourself via ffmpeg and MAMP on local system - RJM Programming - December, 2025</title>
<scri" . "pt type=text/javascript>
  var wothree='top=50,left=50,height=600,width=600';
  var rectthree=null, wotest=null;
  var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
  if (('' + navigator.platform).toLowerCase().indexOf('win') != 0) {
  isSafari=true;
  }
  var wolab=(isSafari ? '_blank' : 'blankif');
  var eletype='" . $mtype . "';
  var mimetype='" . $mimetype . "';
  var newmimetype='" . $mimetype . "';
  var newext=(('' + navigator.platform).toLowerCase().indexOf('win') == 0 ? '.mp4' : '" . $ext . "');
  var qq='\"\"';
  var maxis='0';
 
  function onl() {
    if (('' + navigator.platform).toLowerCase().indexOf('win') == 0) {
      document.getElementById('myform').action=document.getElementById('myform').action.replace(':8888','');
      document.getElementById('selv').innerHTML='<option value=y selected>Screenshot</option><option value=s>Front Camera and Audio</option>';
      document.getElementById('period').value='4';
      document.getElementById('period').min='4';
      maxis='' + document.getElementById('period').max;
      document.getElementById('period').max='4';
    }
    if (('' + location.hash).replace(/^\#/g,'').indexOf('data') == 0) {
      document.getElementById('myaudio').style.display='block';
      //var ds=prompt(decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+'),decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+'));
      if (decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+').indexOf('data:') == 0) {
      newmimetype=decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+').split('data:')[1].split(';')[0];
      if (decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+').indexOf('data:video/') == 0 && document.getElementById('mydiv').innerHTML.indexOf(' src=\"\"') != -1) {
      document.getElementById('mydiv').innerHTML=document.getElementById('mydiv').innerHTML.replace(/audio/g,'video').replace(' src=\"\"', ' src=\"' + decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/^atad/g,'data').replace(/\ /g,'+') + '\"');
      } else if (document.getElementById('mydiv').innerHTML.indexOf(' src=\"\"') != -1) {
      document.getElementById('mydiv').innerHTML=document.getElementById('mydiv').innerHTML.replace(mimetype,newmimetype).replace(' src=\"\"', ' src=\"' + decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+') + '\"');
      } else {
      document.getElementById('mysource').src=decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+');
      }
      } else {
      if (document.getElementById('mydiv').innerHTML.indexOf(' src=\"\"') != -1) {
      document.getElementById('mydiv').innerHTML=document.getElementById('mydiv').innerHTML.replace(' src=\"\"', ' src=\"' + 'data:audio/mp4;base64,' + (('' + location.hash).replace(/^\#/g,'')).substring(4).replace(/\ /g,'+') + '\"');
      } else {
      document.getElementById('mysource').src='data:audio/mp4;base64,' + (('' + location.hash).replace(/^\#/g,'')).substring(4).replace(/\ /g,'+');
      }
      }
    } else if (('' + location.hash).replace(/^\#/g,'').indexOf('atad') == 0) {
      document.getElementById('myaudio').style.display='block';
      //var ds=prompt(decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+'),decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+'));
      if (decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+').indexOf('atad:') == 0) {
      newmimetype=decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+').split('atad:')[1].split(';')[0];
      if (document.getElementById('mydiv').innerHTML.indexOf(' src=\"\"') != -1) {
      document.getElementById('mydiv').innerHTML=document.getElementById('mydiv').innerHTML.replace(mimetype,newmimetype).replace(/audio/g,'video').replace(' src=\"\"', ' src=\"' + decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/^atad/g,'data').replace(/\ /g,'+') + '\"');
      } else {
      document.getElementById('mysource').src=decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+');
      }
      } else {
      if (document.getElementById('mydiv').innerHTML.indexOf(' src=\"\"') != -1) {
      document.getElementById('mydiv').innerHTML=document.getElementById('mydiv').innerHTML.replace(mimetype,newmimetype).replace(/audio/g,'video').replace(' src=\"\"', ' src=\"' + 'data:video/mp4;base64,' + (('' + location.hash).replace(/^\#/g,'')).substring(4).replace(/\ /g,'+') + '\"');
      } else {
      document.getElementById('mysource').src='data:video/mp4;base64,' + (('' + location.hash).replace(/^\#/g,'')).substring(4).replace(/\ /g,'+');
      }
      }
    }
  }
 
  function ons(formo) {
     if (('' + navigator.platform).toLowerCase().indexOf('win') == 0) {
     document.getElementById('blankif').srcdoc='<p>Screen capture soon for up to ' + document.getElementById('period').value + ' seconds ... but there may be a minute delay in play ... ... in which case, later go looking for (in the case of Front Camera and Audio white webcam led will stop displaying) ' + linkit('http://localhost/mic_recording' + newext) + ' ...</p>';
     } else {
     document.getElementById('blankif').srcdoc='<p>Speak soon for up to ' + document.getElementById('period').value + ' seconds ...</p>';
     }
     document.getElementById('blankif').style.visibility='visible';
     document.getElementById('blankif').style.backgroundColor='#f0f0f0';
     document.getElementById('blankif').frameborder='1';  
     //if (('' + navigator.platform).toLowerCase().indexOf('win') != 0) {
     wotest=window.open(formo.action + '?verb=' + encodeURIComponent(document.getElementById('verb').value) + '&video=' + encodeURIComponent(document.getElementById('video').value) + '&passXthru=y', wolab, wothree);
     //}
     if (!wotest && isSafari) {
       formo.target='_blank';
       return true;
     } else {  
       return false;
     }
     return true;
  }
 
  function minmaxit(osel) {
     if (('' + navigator.platform).toLowerCase().indexOf('win') == 0) {
      document.getElementById('period').min='0';
      document.getElementById('period').max=maxis;
     }
  }
 
  function linkit(innards) {
    var retv='<a target=_blank onmouseover=\"' + \"document.getElementById('vdiv').innerHTML=document.getElementById('vdiv').innerHTML.replace('none','block')\" + '.replace(String.fromCharCode(34) + String.fromCharCode(34),String.fromCharCode(34) + this.href + String.fromCharCode(34));\" onclick=\"' + \"document.getElementById('vdiv').innerHTML=document.getElementById('vdiv').innerHTML.replace('none','block')\" + '.replace(String.fromCharCode(34) + String.fromCharCode(34),String.fromCharCode(34) + this.href + String.fromCharCode(34));';
    retv+=' title=\"' + innards + '\" href=\"' + innards + '?rand=' + Math.floor(Math.random() * 1989767543) + '\">' + innards + '</a><br><div id=vdiv style=display:none;><video id=myv controls><source type=video/mp4 src=\"\"></source</video></div>';
    return retv;
  }
</scri" . "pt>
</head>
<body onload=\" onl(); rectthree=document.getElementById('blankif').getBoundingClientRect();  wothree='top=340,left=' + rectthree.left + ',height=' + eval(-160 + eval('' + screen.height) - eval('' + rectthree.top)) + ',width=' + rectthree.width; if (('' + navigator.platform).toLowerCase().indexOf('mac') != 0 && ('' + navigator.platform).toLowerCase().indexOf('win') != 0) { document.getElementById('blankif').style.visibility='visible'; document.getElementById('blankif').srcdoc='<p>Sorry, no macOS nor Windows system detected.</p>';  }\">
<h1>Record yourself via <a target=_blank title='ffmpeg' href='https://www.ffmpeg.org/'>ffmpeg</a> for ...</h1>
<h3>RJM Programming - December, 2025</h3>
<h4></h4>
<div id=mydiv><" . $mtype . " id=myaudio style=display:none; controls><source id=mysource src=\"\" type='" . $mimetype . "'></source></" . $mtype . "></mydiv><br>
<form target=blankif onsubmit=\"return ons(this);\" method=GET id=myform action='HTTP://localhost:8888/recording_ideas.php'>
<span id=myspan>Seconds to record <select onchange=minmaxit(this); style=background-color:#f0f0f0; id=selv name=video><option value=''>Audio</option><option value='y'>Screenshot and Audio</option></select></span><input title='Seconds to record' style=display:inline-block;width:10%; step=1 min=0 max=200 type=number name=period id=period value='10'></input><br><br>
<input type=hidden name=verb id=verb value=''></input>
<input type=submit value=Record style=background-color:orange; onmouseover=\"if (('' + navigator.platform).toLowerCase().indexOf('win') == 0) { document.getElementById('blankif').srcdoc='<p>Screen capture soon for up to ' + document.getElementById('period').value + ' seconds ... but there may be a minute delay in play ... in which case, later go looking for (in the case of Front Camera and Audio white webcam led will stop displaying) ' + linkit('http://localhost/mic_recording' + newext) + ' ...</p>';  } else { document.getElementById('blankif').srcdoc='<p>Speak soon for up to ' + document.getElementById('period').value + ' seconds ...</p>'; }\"></input>
</form>  
<iframe srcdoc=\"<p>Speak now ...</p>\" data-src='/About_Us.html' id=blankif name=blankif style='font-family:courier new;visibility:hidden;width:100%;height:900px;' frameborder=0></iframe>
</body>
</html>";
 }
?>
