139 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			139 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!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>
 | |
|         body {
 | |
|             font-family: Arial, sans-serif;
 | |
|             max-width: 800px;
 | |
|             margin: 0 auto;
 | |
|             padding: 20px;
 | |
|             background-color: #f5f5f5;
 | |
|         }
 | |
|         .container {
 | |
|             background: white;
 | |
|             padding: 30px;
 | |
|             border-radius: 10px;
 | |
|             box-shadow: 0 2px 10px rgba(0,0,0,0.1);
 | |
|         }
 | |
|         .controls {
 | |
|             text-align: center;
 | |
|             margin-bottom: 30px;
 | |
|         }
 | |
|         .record-btn {
 | |
|             background: #4CAF50;
 | |
|             color: white;
 | |
|             border: none;
 | |
|             padding: 15px 30px;
 | |
|             font-size: 18px;
 | |
|             border-radius: 50px;
 | |
|             cursor: pointer;
 | |
|             transition: all 0.3s;
 | |
|         }
 | |
|         .record-btn:hover {
 | |
|             background: #45a049;
 | |
|         }
 | |
|         .record-btn.recording {
 | |
|             background: #f44336;
 | |
|             animation: pulse 1s infinite;
 | |
|         }
 | |
|         @keyframes pulse {
 | |
|             0% { transform: scale(1); }
 | |
|             50% { transform: scale(1.05); }
 | |
|             100% { transform: scale(1); }
 | |
|         }
 | |
|         .status {
 | |
|             margin: 20px 0;
 | |
|             padding: 10px;
 | |
|             border-radius: 5px;
 | |
|             text-align: center;
 | |
|             font-weight: bold;
 | |
|         }
 | |
|         .status.connected {
 | |
|             background: #d4edda;
 | |
|             color: #155724;
 | |
|             border: 1px solid #c3e6cb;
 | |
|         }
 | |
|         .status.speaking {
 | |
|             background: #fff3cd;
 | |
|             color: #856404;
 | |
|             border: 1px solid #ffeaa7;
 | |
|             animation: speaking-pulse 0.5s infinite alternate;
 | |
|         }
 | |
|         .status.processing {
 | |
|             background: #cce7ff;
 | |
|             color: #004085;
 | |
|             border: 1px solid #99d6ff;
 | |
|         }
 | |
|         .status.disconnected {
 | |
|             background: #f8d7da;
 | |
|             color: #721c24;
 | |
|             border: 1px solid #f5c6cb;
 | |
|         }
 | |
|         @keyframes speaking-pulse {
 | |
|             0% { opacity: 0.7; }
 | |
|             100% { opacity: 1; }
 | |
|         }
 | |
|         .results {
 | |
|             max-height: 400px;
 | |
|             overflow-y: auto;
 | |
|             border: 1px solid #ddd;
 | |
|             border-radius: 5px;
 | |
|             padding: 15px;
 | |
|             background: #fafafa;
 | |
|         }
 | |
|         .result-item {
 | |
|             margin-bottom: 15px;
 | |
|             padding: 10px;
 | |
|             background: white;
 | |
|             border-radius: 5px;
 | |
|             border-left: 4px solid #4CAF50;
 | |
|         }
 | |
|         .timestamp {
 | |
|             font-size: 12px;
 | |
|             color: #666;
 | |
|             margin-bottom: 5px;
 | |
|         }
 | |
|         .text {
 | |
|             font-size: 16px;
 | |
|             line-height: 1.4;
 | |
|         }
 | |
|         .help {
 | |
|             margin-top: 20px;
 | |
|             padding: 15px;
 | |
|             background: #e3f2fd;
 | |
|             border-radius: 5px;
 | |
|             font-size: 14px;
 | |
|             color: #1565c0;
 | |
|         }
 | |
|     </style>
 | |
| </head>
 | |
| <body>
 | |
|     <div class="container">
 | |
|         <h1>实时语音识别</h1>
 | |
|         
 | |
|         <div class="controls">
 | |
|             <button id="recordBtn" class="record-btn">开始录音</button>
 | |
|         </div>
 | |
|         
 | |
|         <div id="status" class="status disconnected">未连接</div>
 | |
|         
 | |
|         <div class="help">
 | |
|             <strong>使用说明:</strong><br>
 | |
|             1. 点击"开始录音"按钮开启麦克风<br>
 | |
|             2. 系统会自动检测您的语音,只有在检测到说话时才开始录音<br>
 | |
|             3. 说话结束后会自动发送音频进行识别<br>
 | |
|             4. 识别结果会显示在下方区域
 | |
|         </div>
 | |
|         
 | |
|         <h3>识别结果:</h3>
 | |
|         <div id="results" class="results">
 | |
|             <!-- 识别结果将显示在这里 -->
 | |
|         </div>
 | |
|     </div>
 | |
|     
 | |
|     <script src="new_app.js"></script>
 | |
| </body>
 | |
| </html> |