55 < meta charset ="utf-8 " />
66</ head >
77< body style ="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; ">
8- < table width ="100% ">
9- < tr >
10- < td > </ td >
11- < td >
12- < h1 style ="font-weight:500; "> Speech Recognition</ h1 >
13- < h2 style ="font-weight:500; "> Microsoft Cognitive Services</ h2 >
14- </ td >
15- </ tr >
16- < tr >
17- < td align ="right "> < a href ="https://www.microsoft.com/cognitive-services/en-us/sign-up " target ="_blank "> Subscription</ a > :</ td >
18- < td > < input id ="key " type ="text " size ="40 " value ="YOUR_BING_SPEECH_API_KEY "> </ td >
19- </ tr >
20- < tr >
21- < td align ="right "> Language:</ td >
22- < td align ="left ">
23- < select id ="languageOptions ">
24- < option value ="zh-CN "> Chinese - CN</ option >
25- < option value ="en-GB "> English - GB</ option >
26- < option value ="en-US " selected ="selected "> English - US</ option >
27- < option value ="fr-FR "> French - FR</ option >
28- < option value ="de-DE "> German - DE</ option >
29- < option value ="it-IT "> Italian - IT</ option >
30- < option value ="es-ES "> Spanish - ES</ option >
31- </ select >
32- </ td >
33- </ tr >
34- < tr >
35- < td align ="right "> Recognition Mode:</ td >
36- < td align ="left ">
37- < select id ="recognitionMode ">
38- < option value ="Interactive "> Interactive</ option >
39- < option value ="Conversation "> Conversation</ option >
40- < option value ="Dictation "> Dictation</ option >
41- </ select >
42- </ td >
43- </ tr >
44- < tr >
45- < td align ="right "> Format:</ td >
46- < td align ="left ">
47- < select id ="formatOptions ">
48- < option value ="Simple " selected ="selected "> Simple Result</ option >
49- < option value ="Detailed "> Detailed Result</ option >
50- </ select >
51- </ td >
52- </ tr >
53- < tr >
54- < td align ="right "> Input:</ td >
55- < td align ="left ">
56- < select id ="inputSource ">
57- < option value ="Mic " selected ="selected "> Microphone</ option >
58- < option value ="File "> Audio File</ option >
59- </ select >
60- </ td >
61- </ tr >
62- < tr >
63- < td > </ td >
64- < td >
65- < button id ="startBtn " disabled ="disabled "> Start</ button >
66- < button id ="stopBtn " disabled ="disabled "> Stop</ button >
67- < input type ="file " id ="filePicker " accept =".wav " style ="display:none "/>
68- </ td >
69- </ tr >
70- < tr >
71- < td > </ td >
72- < td >
73- < table >
74- < tr >
75- < td > Results:</ td >
76- < td > Current hypothesis:</ td >
77- </ tr >
78- < tr >
79- < td >
80- < textarea id ="phraseDiv " style ="display: inline-block;width:500px;height:200px "> </ textarea >
81- </ td >
82- < td style ="vertical-align: top ">
83- < span id ="hypothesisDiv " style ="width:200px;height:200px;display:block; "> </ span >
84- </ td >
85- </ tr >
86- </ table >
87- </ td >
88- </ tr >
89- < tr >
90- < td align ="right "> Status:</ td >
91- < td align ="left "> < span id ="statusDiv "> </ span > </ td >
92- </ tr >
93- </ table >
8+ < div id ="warning ">
9+ < h1 style ="font-weight:500; "> Speech Recognition SDK not found.</ h1 >
10+ < h2 style ="font-weight:500; "> Please execute < code > npm run bundle</ code > and reload.</ h2 >
11+ </ div >
12+ < div id ="content " style ="display:none ">
13+ < table width ="100% ">
14+ < tr >
15+ < td > </ td >
16+ < td >
17+ < h1 style ="font-weight:500; "> Speech Recognition</ h1 >
18+ < h2 style ="font-weight:500; "> Microsoft Cognitive Services</ h2 >
19+ </ td >
20+ </ tr >
21+ < tr >
22+ < td align ="right "> < a href ="https://www.microsoft.com/cognitive-services/en-us/sign-up " target ="_blank "> Subscription</ a > :</ td >
23+ < td > < input id ="key " type ="text " size ="40 " value ="YOUR_BING_SPEECH_API_KEY "> </ td >
24+ </ tr >
25+ < tr >
26+ < td align ="right "> Language:</ td >
27+ < td align ="left ">
28+ < select id ="languageOptions ">
29+ < option value ="zh-CN "> Chinese - CN</ option >
30+ < option value ="en-GB "> English - GB</ option >
31+ < option value ="en-US " selected ="selected "> English - US</ option >
32+ < option value ="fr-FR "> French - FR</ option >
33+ < option value ="de-DE "> German - DE</ option >
34+ < option value ="it-IT "> Italian - IT</ option >
35+ < option value ="es-ES "> Spanish - ES</ option >
36+ </ select >
37+ </ td >
38+ </ tr >
39+ < tr >
40+ < td align ="right "> Recognition Mode:</ td >
41+ < td align ="left ">
42+ < select id ="recognitionMode ">
43+ < option value ="Interactive "> Interactive</ option >
44+ < option value ="Conversation "> Conversation</ option >
45+ < option value ="Dictation "> Dictation</ option >
46+ </ select >
47+ </ td >
48+ </ tr >
49+ < tr >
50+ < td align ="right "> Format:</ td >
51+ < td align ="left ">
52+ < select id ="formatOptions ">
53+ < option value ="Simple " selected ="selected "> Simple Result</ option >
54+ < option value ="Detailed "> Detailed Result</ option >
55+ </ select >
56+ </ td >
57+ </ tr >
58+ < tr >
59+ < td align ="right "> Input:</ td >
60+ < td align ="left ">
61+ < select id ="inputSource ">
62+ < option value ="Mic " selected ="selected "> Microphone</ option >
63+ < option value ="File "> Audio File</ option >
64+ </ select >
65+ </ td >
66+ </ tr >
67+ < tr >
68+ < td > </ td >
69+ < td >
70+ < button id ="startBtn " disabled ="disabled "> Start</ button >
71+ < button id ="stopBtn " disabled ="disabled "> Stop</ button >
72+ < input type ="file " id ="filePicker " accept =".wav " style ="display:none "/>
73+ </ td >
74+ </ tr >
75+ < tr >
76+ < td > </ td >
77+ < td >
78+ < table >
79+ < tr >
80+ < td > Results:</ td >
81+ < td > Current hypothesis:</ td >
82+ </ tr >
83+ < tr >
84+ < td >
85+ < textarea id ="phraseDiv " style ="display: inline-block;width:500px;height:200px "> </ textarea >
86+ </ td >
87+ < td style ="vertical-align: top ">
88+ < span id ="hypothesisDiv " style ="width:200px;height:200px;display:block; "> </ span >
89+ </ td >
90+ </ tr >
91+ </ table >
92+ </ td >
93+ </ tr >
94+ < tr >
95+ < td align ="right "> Status:</ td >
96+ < td align ="left "> < span id ="statusDiv "> </ span > </ td >
97+ </ tr >
98+ </ table >
99+ </ div >
94100
95101 <!-- SDK REFERENCE -->
96102 < script src ="../../distrib/speech.sdk.bundle.js "> </ script >
@@ -99,7 +105,11 @@ <h2 style="font-weight:500;">Microsoft Cognitive Services</h2>
99105 < script >
100106 // On document load resolve the SDK dependency
101107 function Initialize ( onComplete ) {
102- onComplete ( window . SDK ) ;
108+ if ( ! ! window . SDK ) {
109+ document . getElementById ( 'content' ) . style . display = 'block' ;
110+ document . getElementById ( 'warning' ) . style . display = 'none' ;
111+ onComplete ( window . SDK ) ;
112+ }
103113 }
104114
105115 // Setup the recognizer
0 commit comments