0) {
$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) {
$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 (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 (PHP_OS == 'Darwin') {
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 "
" . str_replace(" ", " ", str_replace("\t", " ", str_replace("\n","
",$res))) . "
";
}
} 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 "" . str_replace(" ", " ", str_replace("\t", " ", str_replace("\n","
",$verb))) . "
Email " . $mtype . " recording to someone
<" . $mtype . " controls>" . $mtype . ">
";
}
} else if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') {
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);
echo "" . str_replace(" ", " ", str_replace("\t", " ", str_replace("\n","
",$res))) . "
";
}
} 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 "" . str_replace(" ", " ", str_replace("\t", " ", str_replace("\n","
",$res))) . "
";
}
} else {
//echo shell_exec($verb . " | pbcopy; pbpaste");
echo "
Record yourself via ffmpeg and MAMP on local system - RJM Programming - December, 2025
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);
isSafari=true;
var wolab=(isSafari ? '_blank' : 'blankif');
var eletype='" . $mtype . "';
function onl() {
if (('' + navigator.platform).toLowerCase().indexOf('win') == 0) {
document.getElementById('myform').action=document.getElementById('myform').action.replace(':8888','');
}
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) {
if (document.getElementById('mydiv').innerHTML.indexOf(' src=\"\"') != -1) {
document.getElementById('mydiv').innerHTML=document.getElementById('mydiv').innerHTML.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) {
if (document.getElementById('mydiv').innerHTML.indexOf(' src=\"\"') != -1) {
document.getElementById('mydiv').innerHTML=document.getElementById('mydiv').innerHTML.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(/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,'+');
}
}
}
}
Sorry, no macOS nor Windows system detected.'; }\">
Record yourself for ...
RJM Programming - December, 2025
<" . $mtype . " id=myaudio style=display:none; controls>" . $mtype . ">
";
}
?>