| 148 | Subtitle service is running as HTML app on the tablet and receiving updates via Javascript messaging API. See `dialog_subtitles` app, specifically `dialog_subtitles/html/js/`. |
| 149 | |
| 150 | HTML app can subscribe to various robot API events: |
| 151 | |
| 152 | {{{ |
| 153 | RobotUtils.subscribeToALMemoryEvent("SpeechDetected", onSpeechDetected); |
| 154 | RobotUtils.subscribeToALMemoryEvent("ALSpeechRecognition/Status", onSpeechStatus); |
| 155 | RobotUtils.subscribeToALMemoryEvent("WordRecognizedAndGrammar", onWordRecognized); |
| 156 | }}} |
| 157 | |
| 158 | And update the webpage when events are triggered, eg. display recognized word: |
| 159 | |
| 160 | {{{ |
| 161 | function onWordRecognized(value) |
| 162 | { |
| 163 | document.getElementById("word").innerHTML = value; |
| 164 | } |
| 165 | }}} |
| 166 | |