添加等待描述
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m47s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m47s
				
			This commit is contained in:
		
							parent
							
								
									4a25beed44
								
							
						
					
					
						commit
						8dc78dd6e3
					
				| @ -118,6 +118,27 @@ | |||||||
|         .video-loading.show { |         .video-loading.show { | ||||||
|             opacity: 1; |             opacity: 1; | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         /* 等待连接提示样式 */ | ||||||
|  |         .connection-waiting { | ||||||
|  |             position: absolute; | ||||||
|  |             top: 50%; | ||||||
|  |             left: 50%; | ||||||
|  |             transform: translate(-50%, -50%); | ||||||
|  |             z-index: 20; | ||||||
|  |             color: white; | ||||||
|  |             font-size: 18px; | ||||||
|  |             text-align: center; | ||||||
|  |             background: rgba(0, 0, 0, 0.7); | ||||||
|  |             padding: 30px; | ||||||
|  |             border-radius: 15px; | ||||||
|  |             backdrop-filter: blur(10px); | ||||||
|  |             transition: opacity 0.3s ease; | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         .connection-waiting.show { | ||||||
|  |             opacity: 1; | ||||||
|  |         } | ||||||
|          |          | ||||||
|         /* 加载动画 */ |         /* 加载动画 */ | ||||||
|         .loading-spinner { |         .loading-spinner { | ||||||
| @ -451,6 +472,12 @@ | |||||||
|                         <div class="loading-spinner"></div> |                         <div class="loading-spinner"></div> | ||||||
|                         <!-- <div>正在切换视频...</div> --> |                         <!-- <div>正在切换视频...</div> --> | ||||||
|                     </div> |                     </div> | ||||||
|  | 
 | ||||||
|  |                     <!-- 等待连接提示 --> | ||||||
|  |                     <div class="connection-waiting" id="connectionWaiting" style="display: none;"> | ||||||
|  |                         <div class="loading-spinner"></div> | ||||||
|  |                         <div style="color: white; font-size: 18px; margin-top: 10px;">等待连接通话中...</div> | ||||||
|  |                     </div> | ||||||
|                 </div> |                 </div> | ||||||
|                  |                  | ||||||
|                 <div class="video-info" style="display: none;"> |                 <div class="video-info" style="display: none;"> | ||||||
|  | |||||||
							
								
								
									
										37
									
								
								src/index.js
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								src/index.js
									
									
									
									
									
								
							| @ -115,6 +115,9 @@ class WebRTCChat { | |||||||
|         this.messageLog = document.getElementById('messageLog'); |         this.messageLog = document.getElementById('messageLog'); | ||||||
|         this.currentVideoName = document.getElementById('currentVideoName'); |         this.currentVideoName = document.getElementById('currentVideoName'); | ||||||
|         this.videoList = document.getElementById('videoList'); |         this.videoList = document.getElementById('videoList'); | ||||||
|  | 
 | ||||||
|  |         // 等待连接提示元素
 | ||||||
|  |         this.connectionWaiting = document.getElementById('connectionWaiting'); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     initializeSocket() { |     initializeSocket() { | ||||||
| @ -828,8 +831,33 @@ class WebRTCChat { | |||||||
|         // this.stopVoiceButton.onclick = () => this.stopVoiceRecording();
 |         // this.stopVoiceButton.onclick = () => this.stopVoiceRecording();
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     // 显示等待连接提示
 | ||||||
|  |     showConnectionWaiting() { | ||||||
|  |         if (this.connectionWaiting) { | ||||||
|  |             this.connectionWaiting.style.display = 'block'; | ||||||
|  |             // 使用setTimeout确保display设置后再添加show类
 | ||||||
|  |             setTimeout(() => { | ||||||
|  |                 this.connectionWaiting.classList.add('show'); | ||||||
|  |             }, 10); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     // 隐藏等待连接提示
 | ||||||
|  |     hideConnectionWaiting() { | ||||||
|  |         if (this.connectionWaiting) { | ||||||
|  |             this.connectionWaiting.classList.remove('show'); | ||||||
|  |             // 等待动画完成后隐藏元素
 | ||||||
|  |             setTimeout(() => { | ||||||
|  |                 this.connectionWaiting.style.display = 'none'; | ||||||
|  |             }, 300); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     async startCall() { |     async startCall() { | ||||||
|         try { |         try { | ||||||
|  | 
 | ||||||
|  |             // 显示等待连接提示
 | ||||||
|  |             this.showConnectionWaiting(); | ||||||
|             // 切换到通话中图标
 |             // 切换到通话中图标
 | ||||||
|             this.switchToCallingIcon(); |             this.switchToCallingIcon(); | ||||||
|              |              | ||||||
| @ -870,15 +898,22 @@ class WebRTCChat { | |||||||
|              |              | ||||||
|             // 开始播放当前场景的默认视频
 |             // 开始播放当前场景的默认视频
 | ||||||
|             await this.startDefaultVideoStream(); |             await this.startDefaultVideoStream(); | ||||||
|  | 
 | ||||||
|  |             // 隐藏等待连接提示
 | ||||||
|  |             this.hideConnectionWaiting(); | ||||||
|              |              | ||||||
|         } catch (error) { |         } catch (error) { | ||||||
|             // 如果出错,恢复到默认图标
 |             // 如果出错,隐藏等待连接提示并恢复到默认图标
 | ||||||
|  |             this.hideConnectionWaiting(); | ||||||
|             this.switchToDefaultIcon(); |             this.switchToDefaultIcon(); | ||||||
|             this.logMessage('无法访问麦克风: ' + error.message, 'error'); |             this.logMessage('无法访问麦克风: ' + error.message, 'error'); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     stopCall() { |     stopCall() { | ||||||
|  | 
 | ||||||
|  |         // 隐藏等待连接提示
 | ||||||
|  |         this.hideConnectionWaiting(); | ||||||
|         // 恢复到默认图标
 |         // 恢复到默认图标
 | ||||||
|         this.switchToDefaultIcon(); |         this.switchToDefaultIcon(); | ||||||
|          |          | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Song367
						Song367