Skip to content
Snippets Groups Projects
Commit ac751693 authored by Lucio Zambon's avatar Lucio Zambon
Browse files

Update talk.php

parent f967ae16
No related branches found
No related tags found
No related merge requests found
......@@ -108,7 +108,7 @@ CREATE TABLE IF NOT EXISTS ujive (
}
if (!empty($_REQUEST['ctree'])) {
dbUpsert('ujive', $_REQUEST['token'], $_REQUEST['ctree']);
/* do NOT wait for a response
// wait for a response
for ($i=0; $i<50; $i++) {
$f = dbRead('ujive', $_REQUEST['token']);
if (!empty($f) && $f != $_REQUEST['ctree']) {
......@@ -120,9 +120,11 @@ CREATE TABLE IF NOT EXISTS ujive (
}
dbUpsert('ujive', $_REQUEST['token'], '');
mylog(", R: timeout");
die("{$_REQUEST['ctree']} not found, timeout");
*/
die('OK');
die("{$_REQUEST['ctree']} not responding, timeout");
// die('OK');
}
if (isset($_REQUEST['ctreeresult'])) {
dbUpsert('ujive', $_REQUEST['token'], substr($_REQUEST['ctreeresult'], 0, 50));
}
if (!empty($_REQUEST['ujive'])) {
set_time_limit(0);
......@@ -288,30 +290,41 @@ CREATE TABLE IF NOT EXISTS ujive (
</head>
<body onLoad='myload()' style="background-color: rgb(0, 0, 0, 0);">
<div id='transcriptDiv' style='display:none;'></div>
<div style="max-width: 280px; max-height: 30px; text-align: center;">
<div style="max-width: 360px; max-height: 30px; text-align: center;">
<audio id='speechText' onended='speakagain();' onerror='showLog("audio err: "+event.error)'></audio>
<span style='color: darkgreen; font-weight: bold;' id='title'>Talk to ...</span>
<img src='./microphone-na.png' onClick='naClick()' title='not available' id='micna'>
<img src='./microphone-on.png' onClick='stopRec()' id='micstart' style='display: none; padding-right: 60px; max-width: 300px;'>
<img src='./microphone-off.png' onClick='startRec()' id='micstop' style='display: none; padding-right: 60px;'>
<img src='./microphone-on.png' onClick='stopRec()' id='micstart' style='display: none; padding-right: 40px; max-width: 270px;'>
<img src='./microphone-off.png' onClick='startRec()' id='micstop' style='display: none; padding-right: 40px;'>
<div style='cursor: pointer;padding-right: 5px; text-align: right; margin-top: -1.3em;' id='langselect'>
<img style="max-height: 18px; margin-right: 10px;" src='./it-IT.png' onClick="switchLocale('it')">
<img style="max-height: 18px; margin-right: 10px;" src='./en-US.png' onClick="switchLocale('en')">
<span style='color: darkgreen; font-weight: bold;' onClick='commandlistinfo()'> ? </span>
</div>
<div style='padding-left: 5px; text-align: left; margin-top: -1.3em;' id='operation'>
<img style="margin-right: 10px;" id='open' src='./open.png'>
<img style="margin-right: 10px;" id='search' src='./search.png'>&nbsp;
<img style="margin-right: 10px;" id='open' src='./open.png' title='open panel'>
<img style="margin-right: 10px;" id='search' src='./search.png' title='search'>
<img style="margin-right: 10px;" id='tree' src='./tree.png' title='uJive'>
<img style="margin-right: 10px; display: none;" id='chart' src='./chart.png' title='chart'>&nbsp;
</div>
<span style='color: darkblue; font-weight: bold;' id='miclabel'>comandi vocali&nbsp;&nbsp;&nbsp;</span>
<table id ='openTable' class="table table-hover"></table>
<span id='ctree'></span>
<pre id='log'></pre>
<script>
function inIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
// showLog('webkitSpeechRecognition: '+ typeof window.webkitSpeechRecognition);
// showLog('SpeechRecognition: '+ typeof window.SpeechRecognition);
window.SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition;
if (typeof window.SpeechRecognition == 'undefined' && document.location.search.indexOf('?d=')==-1) {
// if (typeof window.SpeechRecognition == 'undefined' && document.location.search.indexOf('?d=')==-1) {
if (inIframe()) {
let tok = document.location.search.indexOf('token=')==-1? Math.round(Math.random()*1000000000000+1): document.location.search.split('token=')[1].split('&')[0];
if (isNaN(tok) || tok<1000000000) tok = Math.round(Math.random()*1000000000000+1);
console.log('./qr.php?data='+tok+'&host=<?php echo $host;?>');
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment