ok
This commit is contained in:
		
							parent
							
								
									e1d4b545d6
								
							
						
					
					
						commit
						25ad982b5f
					
				
							
								
								
									
										13
									
								
								src/index.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/index.js
									
									
									
									
									
								
							| @ -621,15 +621,17 @@ class WebRTCChat { | |||||||
|         try { |         try { | ||||||
|             this.logMessage(`开始平滑切换视频流: ${videoFile} (${type})`, 'info'); |             this.logMessage(`开始平滑切换视频流: ${videoFile} (${type})`, 'info'); | ||||||
|              |              | ||||||
|             // 显示加载指示器
 |             // 检查是否已缓存,如果已缓存则不显示加载指示器
 | ||||||
|  |             const isCached = this.videoStreams.has(videoFile); | ||||||
|  |             if (!isCached) { | ||||||
|                 this.showVideoLoading(); |                 this.showVideoLoading(); | ||||||
|  |             } | ||||||
|              |              | ||||||
|             // 确定当前活跃的视频元素和缓冲元素
 |             // 确定当前活跃的视频元素和缓冲元素
 | ||||||
|             const currentVideo = this.activeVideoElement === 'main' ? this.recordedVideo : this.recordedVideoBuffer; |             const currentVideo = this.activeVideoElement === 'main' ? this.recordedVideo : this.recordedVideoBuffer; | ||||||
|             const bufferVideo = this.activeVideoElement === 'main' ? this.recordedVideoBuffer : this.recordedVideo; |             const bufferVideo = this.activeVideoElement === 'main' ? this.recordedVideoBuffer : this.recordedVideo; | ||||||
|              |              | ||||||
|             // 检查是否已缓存
 |             // 检查是否已缓存
 | ||||||
|             const isCached = this.videoStreams.has(videoFile); |  | ||||||
|             let newStream; |             let newStream; | ||||||
|              |              | ||||||
|             if (isCached) { |             if (isCached) { | ||||||
| @ -674,11 +676,13 @@ class WebRTCChat { | |||||||
|                 bufferVideo.play().catch(onError); |                 bufferVideo.play().catch(onError); | ||||||
|             }); |             }); | ||||||
|              |              | ||||||
|             // 隐藏加载指示器
 |             // 只有显示了加载指示器才隐藏
 | ||||||
|  |             if (!isCached) { | ||||||
|                 this.hideVideoLoading(); |                 this.hideVideoLoading(); | ||||||
|  |             } | ||||||
|              |              | ||||||
|             // 执行淡入淡出切换
 |             // 执行淡入淡出切换
 | ||||||
|             await this.performVideoTransition(currentVideo, bufferVideo); |             // await this.performVideoTransition(currentVideo, bufferVideo);
 | ||||||
|              |              | ||||||
|             // 更新当前视频流和活跃元素
 |             // 更新当前视频流和活跃元素
 | ||||||
|             this.currentVideoStream = newStream; |             this.currentVideoStream = newStream; | ||||||
| @ -712,6 +716,7 @@ class WebRTCChat { | |||||||
|              |              | ||||||
|         } catch (error) { |         } catch (error) { | ||||||
|             this.logMessage(`平滑切换视频流失败: ${error.message}`, 'error'); |             this.logMessage(`平滑切换视频流失败: ${error.message}`, 'error'); | ||||||
|  |             // 确保隐藏加载指示器
 | ||||||
|             this.hideVideoLoading(); |             this.hideVideoLoading(); | ||||||
|              |              | ||||||
|             // 如果切换失败,尝试回到默认视频
 |             // 如果切换失败,尝试回到默认视频
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Song367
						Song367