diff --git a/src/components/HlsPlayer/index.vue b/src/components/HlsPlayer/index.vue index 210f04e..019546c 100644 --- a/src/components/HlsPlayer/index.vue +++ b/src/components/HlsPlayer/index.vue @@ -160,10 +160,6 @@ initializePlayer() { if (!this.isActive || !this.url) return - // 如果是重新初始化播放器,先清理已存在的资源 - if (this.hls) { - this.immediateCleanup() - } if(this.url.startsWith('http://192.168.77.200:8050/')){ this.hls = new WebRTCWhep({ url: this.url, // WHEP 服务器地址 @@ -180,6 +176,10 @@ // this.initializePlayer(); }) }else{ + // 如果是重新初始化播放器,先清理已存在的资源 + if (this.hls) { + this.immediateCleanup() + } this.hls = new Hls({ // 内存优化配置 maxBufferSize: 0, // 降低缓冲区大小(15MB)