SpeechRecognition实现浏览器端语音识别聊天对话效果代码

代码语言:html

所属分类:其他

代码描述:SpeechRecognition实现浏览器端语音识别聊天对话效果代码

代码标签: SpeechRecognition 浏览器端 语音 识别 聊天 对话

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">

    <style>
        * {
          padding: 0;
          margin: 0;
          box-sizing: border-box;
        }
        html {
          font-family: "Montserrat";
          font-size: 20px;
        }
        section {
          min-height: 100vh;
          width: 100%;
          display: flex;
          align-items: flex-start;
          background-color: rgb(37, 37, 37);
          flex-direction: column;
          padding: 50px 0;
        }
        section h1 {
          color: rgba(255, 255, 255, 0.322);
          text-align: center;
          width: 100%;
          font-size: 50px;
          margin-bottom: 10px;
        }
        section p {
          text-align: center;
          color: rgba(255, 255, 255, 0.322);
          width: 100%;
          margin-bottom: 40px;
        }
        .container {
          width: 90%;
          max-width: 500px;
          margin: 0 auto;
          justify-content: center;
        }
        .texts p {
          color: black;
          text-align: left;
          width: 100%;
          background-color: white;
          padding: 10px;
          border-radius: 8px;
          margin-bottom: 10px;
        }
        .texts p.replay {
          text-align: right;
        }
    </style>


</head>

<body>
    <section>
        <h1>Speech<br> Recognition</h1>
        <p>Available In Chrome😎 Only</p>
        <div class="container">
            <div class="texts">
            </div>
        </div>
    </section>


    <script>
        const texts = document.querySelector(".texts");
        
        window.SpeechRecognition =
        window.SpeechRecognition || .........完整代码请登录后点击上方下载按钮下载查看

网友评论0