js浏览器中实现录制SpeechSynthesisUtterance播报的声音示例代码

代码语言:html

所属分类:其他

代码描述:js浏览器中实现录制SpeechSynthesisUtterance播报的声音示例代码,SpeechSynthesisUtterance是可以录制的,只是有点麻烦。

代码标签: js 浏览器 录制 SpeechSynthesisUtterance 播报 声音 示例 代码

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

<!DOCTYPE html>
<html lang="zh-CN">
<head>
   
<meta charset="UTF-8">
   
<meta name="viewport" content="width=device-width, initial-scale=1.0">
   
<title>屏幕录制与语音合成解决方案</title>
   
<style>
        :root {
            --primary: #4361ee;
            --secondary: #3f37c9;
            --success: #4cc9f0;
            --danger: #f72585;
            --dark: #212529;
            --light: #f8f9fa;
        }
       
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
       
        body {
            background: linear-gradient(135deg, #1e3c72, #2a5298);
            color: white;
            min-height: 100vh;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
       
        .container {
            max-width: 1000px;
            width: 100%;
            background: rgba(255, 255, 255, 0.08);
            backdrop-filter: blur(10px);
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            margin-top: 20px;
        }
       
        header {
            text-align: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid rgba(255, 255, 255, 0.1);
        }
       
        h1 {
            font-size: 2.8rem;
            margin-bottom: 15px;
            background: linear-gradient(to right, #00c6ff, #0072ff);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
       
        .subtitle {
            font-size: 1.2rem;
            opacity: 0.85;
            max-width: 700px;
            margin: 0 auto;
        }
       
        .content {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 25px;
            margin-bottom: 30px;
        }
       
        @media (max-width: 768px) {
            .content {
                grid-template-columns: 1fr;
            }
        }
       
        .panel {
            background: rgba(0, 0, 0, 0.25);
            border-radius: 12px;
            padding: 25px;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
       
        .panel:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
        }
       
        .panel h2 {
            margin-bottom: 20px;
            font-size: 1.5rem;
            color: var(--success);
            display: flex;
            align-items: center;
            gap: 10px;
        }
       
        .panel h2 i {
            font-size: 1.8rem;
        }
       
        textarea {
            width: 100%;
            height: 150px;
            padding: 15px;
            border-radius: 8px;
            border: none;
            background: rgba(255, 255, 255, 0.1);
            color: white;
            font-size: 1.1rem;
            margin-bottom: 20px;
            resize: vertical;
        }
       
        textarea::placeholder {
            color: rgba(255, 255, 255, 0.5);
        }
       
        .controls {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-top: 20px;
        }
       
        button {
            flex: 1;
            min-width: 140px;
            padding: 14px 20px;
            border: none;
            border-radius: 8px;
            background: linear.........完整代码请登录后点击上方下载按钮下载查看

网友评论0