JSFiddle - React, Tailwind, and code Playground

by velo_ninja

HTML

<!DOCTYPE html>
<html>
<head>
    <title>Speech recognition</title>
    <style>
        #result {
            border: 2px solid black;
            height: 200px;
            border-radius: 3px;
            font-size: 14px;
            white-space: pre-wrap;
            overflow-y: auto;
            margin-bottom: 10px;
        }
        #finalText {
            border: 2px solid black;
            height: 100px;
            width: 600px;
            border-radius: 3px;
            font-size: 14px;
            white-space: pre-wrap;
            overflow-y: auto;
            margin-bottom: 10px;
        }
        button {
            position: absolute;
            top: 240px;
            left: 50%;
            margin-right: -50%;
            transform: translate(-50%, -50%);
        }
        #voiceStrength {
            width: 200px;
            height: 20px;
            background-color: #eee;
            position: relative;
            margin-bottom: 10px;
        }
        #voiceStrength canvas {
            display: block;
            width: 100%;
            height: 100%;
        }
        #languageDropdown {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            display: none;
            text-align: center;
        }
    </style>
    
    
    
    
    
    <script type="application/javascript">
    
    		function init () {
          // when a message is received from the page code
          window.onmessage = (event) => {
            if (event.data) {console.log("HTML Code Element received a message!");
              	console.log(event.data);
              start();
            }
          }
        }
    
        var recognition; // Declare recognition outside the function
        var isRecording = false;
        var stopRecordingTimeout;

        async function start() {
            var resultDiv = document.getElementById("result");
            var finalTextDiv =...