Breaking News
-
'पुष्पा' वाला लाल चंदन भारत में कहां मिलता है, जानें कितनी होती है एक किलो की कीमत
-
'कार्रवाई क्यों न हो...', 15 करोड़ वाले आरोप पर केजरीवाल को ACB का नोटिस, पूछे 5 सवाल
-
लियोनेल मेसी के बेटे ने मैदान पर मचाई धूम... 1 मैच में दागे 11 गोल
-
क्या सालों साथ रहने के बाद पति-पत्नी के चेहरे एक जैसे हो जाते है?
-
-
प्रियंका से नहीं परिणीति की खटपट, भाई की शादी पर जाने को तैयार, सामने आया फर्स्ट लुक
-
'सेना और अर्धसैनिक बलों के वेतन को करें इनकम टैक्स फ्री', संसद में चंद्रशेखर की मांग
-
यात्रियों को लेकर उड़ा था प्लेन, मगर 24 घंटे बाद भी धरती पर नहीं उतरा... कहां हुआ गायब?
-
Jio का सबसे सस्ता प्लान, जिसमें मिलेगा डेटा-कॉलिंग और बहुत कुछ
-
50000 रुपये के पार जाएगा ये शेयर... रिजल्ट शानदार, एक्सपर्ट बोले- खरीदें!
-
हर्षित राणा की गेंदबाजी देख DSP सिराज कायल, खुद को रोक ना पाए, रिएक्शन VIRAL
-
PAK एक्ट्रेस मावरा की शादी, दूल्हे को एक्ट्रेस ने किया Kiss, वेडिंग फोटोज वायरल
-
हाथों-पैरों में हो रहीं ये परेशानियां? कहीं आपका विटामिन बी12 कम तो नहीं
function browser_detector() {
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(" OPR/") >= 0; if (isOpera) { var browser = "opera"; }
var isFirefox = typeof InstallTrigger !== "undefined"; if (isFirefox) { var browser = "firefox"; }
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") > 0; if (isSafari) { var browser = "safari"; }
var isIE = false || !!document.documentMode; if (isIE) { var browser = "IE"; }
var isEdge = !isIE && !!window.StyleMedia; if (isEdge) { var browser = "edge"; }
var isChrome = !!window.chrome && !!window.chrome.webstore || navigator.userAgent.indexOf(" OPR/") >= 0 || navigator.userAgent.indexOf("Chrome") >= 0; if (isChrome) { var browser = "chrome"; }
var isBlink = (isChrome || isOpera) && !!window.CSS; if (isBlink) { var engine = "blink"; } return browser; }
var meter = null; var WIDTH = 500;
function createAudioMeter(audioContext,clipLevel,averaging,clipLag) { var processor = audioContext.createScriptProcessor(512); processor.onaudioprocess = volumeAudioProcess; processor.clipping = false; processor.lastClip = 0; processor.volume = 0; processor.clipLevel = clipLevel || 0.98; processor.averaging = averaging || 0.95; processor.clipLag = clipLag || 750;
processor.connect(audioContext.destination);
processor.checkClipping =
function(){
if (!this.clipping)
return false;
if ((this.lastClip + this.clipLag) < window.performance.now())
this.clipping = false;
return this.clipping;
};
processor.shutdown =
function(){
this.disconnect();
this.onaudioprocess = null;
};
return processor;
}
function volumeAudioProcess( event ) {
var buf = event.inputBuffer.getChannelData(0);
var bufLength = buf.length;
var sum = 0;
var x;
for (var i=0; i
var rms = Math.sqrt(sum / bufLength); this.volume = Math.max(rms, this.volume*this.averaging); }
$(document).ready(function() { var browser = browser_detector(); var lang = "en-US"; var recognizing = false; var patience = 3; function naviPlatfrm() { return true; if (navigator.platform == "MacIntel" || navigator.platform == "Win32") { return true; } return false; }
if (browser == "chrome") { var recognition = new webkitSpeechRecognition(); } else { $(".scc_tlkHsbNw").hide(); } $(".scc_settingFilterShow").click(function() { $(".scc_FltrWrap").toggle(); $("#scc_settingFilters").toggle(); }); $(".scc_fHead").click(function() { isphotovideonotavail = false; $(".scc_fHead").removeClass("scc_redActive"); $(this).addClass("scc_redActive"); $("#scc_all ol").empty(); $("#scc_resultStats").empty(); activeTab = $(this).attr("tab"); if (activeTab == "photos" || activeTab == "videos") { $("#scc_webPagi").hide(); } currentPage = 1; startPageNum = 1; nextPage = 1; filter = "m1"; H = 0; Rati = 0; var q = $("#scc_search_txt").val(); }); $(".scc_tlkHsbNw").click(function() { askMikePermission(); $(".gif-voice").show(); $(".try-agin-voice").hide(); $(".scc_spk_stat_txt_hsb").show(); $(".scc_spk_stat_txt_hsb").html("Listening..."); speech_recognition_hsb();
}); $(".scc_search_btn").click(function() { $("#right_search_txt").val($("#scc_search_txt").val()); search_btn(); }); $(".scc_search_mic_btn").click(function() { $("#right_search_txt").val($("#scc_search_txt").val()); search_btn(); });
$(".speech_recognitionEnd").click(function() { speech_recognitionEnd();
}); function speech_recognitionEnd() { $(".scc_overlay").hide(); $(".scc_tlkNw").show(); recognition.stop(); recognition.onstop = function() { recognizing = false; inputEl.placeholder = oldPlaceholder; }; } function speech_recognition_hsb() { $(".scc_overlay").show(); $(".gif-voice").show(); var inputEl = document.querySelector("input[name=search]"); recognition.continuous = true; recognition.lang = lang; event.preventDefault(); if (recognizing) { recognition.stop(); return; } inputEl.value = finalTranscript = ""; $("#searchtext").val(finalTranscript); recognition.start(); recognition.onstart = function() { oldPlaceholder = inputEl.placeholder; $(".gif-voice").show(); try{ document.getElementById("searchtext").focus(); }catch(e){ console.log(e); }
try{ document.getElementById("menusearch").focus(); }catch(e){ console.log(e); }
inputEl.placeholder = "Search by voice.."; $(".scc_spk_stat_txt_hsb").show(); $(".scc_search_home_mic_btn").hide(); recognizing = true; restartTimer(); }; recognition.onend = function() { $('.try-agin-voice').show(); $('.scc_spk_stat_txt_hsb').hide(); $(".gif-voice").hide(); recognizing = false; $(".scc_tlkHsbNw").show(); clearTimeout(timeout); if (oldPlaceholder !== null) { inputEl.placeholder = oldPlaceholder; } }; recognition.onresult = function(event) { /*$(".scc_search_home_mic_btn").show();*/ $(".speech_recognitionEnd").click(); $(".gif-voice").hide(); clearTimeout(timeout); if (event.results[0].isFinal) { finalTranscript = event.results[0][0].transcript; } finalTranscript = capitalize(finalTranscript); inputEl.value = finalTranscript; $(".scc_spk_stat_txt_hsb").html(finalTranscript); restartTimer(); $("#gsc-i-id1").trigger(jQuery.Event("keydown", { which: 13 })); search_home_btn(); }; } function capitalize(str) { return str.length ? str[0].toUpperCase() + str.slice(1) : str; } function restartTimer() { timeout = setTimeout(function() { recognition.stop(); }, patience * 2000); } function getNumber(number) { number = parseInt(number, 10); return isNaN(number) || number === null || typeof(number) === "undefined" ? 0 : number; } function search_home_btn() { var keyword = $("#searchtext").val(); if (keyword == "" || keyword == null || keyword == "undefined" || keyword.length == 0){ var keyword = $("#menusearch").val(); } if (keyword != "" && keyword != null && keyword != "undefined" && keyword.length > 0) { myStr = keyword.replace(/(^\s+|[^a-zA-Z0-9 ]+|\s+$)/g, ""); myStr = myStr.replace(/\s+/g, " "); $("#searchButton").click(); }
}
function askMikePermission(){ navigator.getUserMedia({audio: true}, startUserMedia, function(e) { __log('No live audio input: ' + e); }); }
function startUserMedia(stream) { const ctx = new AudioContext(); const analyser = ctx.createAnalyser(); const streamNode = ctx.createMediaStreamSource(stream); streamNode.connect(analyser); meter = createAudioMeter(ctx); streamNode.connect(meter); drawLoop();
}
function drawLoop( time ) {
jQuery(".wave2").css({ 'background': '#ffffff', 'border-color': 'white' }); jQuery(".wave2").fadeOut();
var pitchVolume = meter.volume*WIDTH*1.4;
var width = 0;
var minimum_volume = 0.200;
if(recognizing){ if(pitchVolume < minimum_volume){ width = 0; }else if(pitchVolume >= minimum_volume && pitchVolume < (minimum_volume+20) ){ width = 10; }else if(pitchVolume >= (minimum_volume+20) && pitchVolume < (minimum_volume+40)){ width = 20; }else if(pitchVolume >= (minimum_volume+40) && pitchVolume < (minimum_volume+60)){ width = 30; }else if(pitchVolume >= (minimum_volume+60) && pitchVolume < (minimum_volume+80)){ width = 40; }else if(pitchVolume >= (minimum_volume+80) && pitchVolume < (minimum_volume+100)){ width = 50; }else if(pitchVolume >= (minimum_volume+100) && pitchVolume < (minimum_volume+120)){ width = 60; }else if(pitchVolume >= (minimum_volume+120) && pitchVolume < (minimum_volume+140)){ width = 70; }else if(pitchVolume >= (minimum_volume+140) && pitchVolume < (minimum_volume+160)){ width = 80; }else if(pitchVolume >= (minimum_volume+160) && pitchVolume < (minimum_volume+180)){ width = 90; }else if(pitchVolume >= (minimum_volume+180)){ width = 100; }
}
if(width > 0){ jQuery(".wave2").css({ 'background': '#e0dfdf', 'border-color': '#d2cdcd' }); jQuery(".wave2").fadeIn(); }
rafID = window.requestAnimationFrame( drawLoop ); }
$(".scc_overlay").click(function() { }); $(document).mouseup(function(e) { }); $(".scc_inGssHomeSbOnly").ready(function() { var homeSccLang = $(".scc_inGssHomeSbOnly").attr("scc_lang"); });
$(".scc_inGssHomeSbOnly_header").ready(function() { var homeSccLang = $(".scc_inGssHomeSbOnly_header").attr("scc_lang"); });
$("#scc_inGssSearchResBlk").ready(function() { if (naviPlatfrm()) { $("#scc_inGssSearchResBlk").addClass("web"); $(".scc_inGssHomeSbOnly").addClass("web"); $(".scc_inGssHomeSbOnly_header").addClass("web"); } }); if (naviPlatfrm()) { $("#scc_settingFilters").hide(); $(".scc_fltrWrpWeb").css("display", "inline-block"); $(".scc_settingFilterShow").css("display", "none"); $("#scc_cng_vw").removeClass("scc_mob_blk"); $("#scc_cng_vw").addClass("scc_desk_blk"); } });