lundi 23 mars 2015

How I should search recorded voice recognized as text in database of subtitles?

I have JS which record voice, automatically stop recording after pause and recognize it by Google server and then send back as text (search_query). This is the part of this code:





final_transcript = capitalize(final_transcript);
var queryTextField = document.getElementById("search_query");
queryTextField.value = final_transcript;
final_span.innerHTML = linebreak(final_transcript); /
interim_span.innerHTML = linebreak(interim_transcript);
if (final_transcript || interim_transcript) {
showButtons('inline-block');



This code send recognized text through "search_query" and this text is shown in placeholder on screen and when user see recognized text he can press Submit "search" button and searching is starting by "search" function - "media/search". You can see it in this code:





<form class="input-group navbar-form" action="<?php echo base_url();?>media/search" method="post"></li>
<li style="margin-top:8px;"><input type="text" class="form-control" placeholder="Search subtitles..." id="search_query" name="string" /></li>
<li style="margin:8px><button type="submit" class="btn btn-info" name="btn_search"><i class="search "></i></button>



It works fine but I want to make automatic searching. So when you record word it immediatelly start to search the word in subtitles. So JS will immediately call function "media/search" (not use "search_query") wihch will search the word in database of subtitles. Thanks for your help.


Aucun commentaire:

Enregistrer un commentaire