chrome Web Speech API实现全球语言转文字效果代码

代码语言:html

所属分类:多媒体

代码描述:chrome Web Speech API实现全球语言转文字效果代码,主要需要您的网络能够访问google服务

代码标签: API 实现 全球 语言 文字 效果

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

<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Web Speech APIU</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap.4.3.1.min.css">
    <style>
        #info a {
            color: darkred;
            text-decoration: underline;
        }

        .final {
            color: black;
            padding-right: 3px;
        }
        .interim {
            color: gray;
        }
        #results {
            font-size: 14px;
            font-weight: bold;
            border: 1px solid #ddd;
            padding: 15px;
            text-align: left;
            min-height: 150px;
            margin: 0 0 20px 0;
        }
        #start_button {
            border: 0;
            background-color: transparent;
            padding: 0;
            cursor: pointer;
        }
        #start_img {
            width: 50px;
            height: 50px;
        }

        .btn-primary {
            width: 100px;
            margin: auto;
        }

        select {
            padding: 5px 5px;
        }

@media screen and (max-width: 767px) {
            #select_dialect {
                position: absolute;
                right: 0;
            }
        }

@media screen and (min-width: 768px) {
            select {
                margin-right: 10px;
            }
        }
    </style>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>
</head>
<body>
    <main>
        <div class="container mt-3">
            <h3 class="text-center">Web Speech API Demo</h3>
            <p>需要你的网络能访问google服务</p>
            <div id="info"></div>
            <div class="float-right">
                <button id="start_button">
                    <img id="start_img" src="//repo.bfw.wiki/bfwrepo/icon/60ff82091152a.gif" alt="Start"></button>
            </div>
            <div id="results">
                <span id="final_span" class="final"></span>
                <span id="interim_span" class="interim"></span>
                <p>
                </div>
                <div class="row col-12 p-0 m-0">
                    <div class="row col-12 col-md-8 col-lg-6 p-0 m-0">
                        <select id="select_language"></select>
                        <select id="select_dialect"></select>
                .........完整代码请登录后点击上方下载按钮下载查看

网友评论0