feat 关闭src, 切断视频流

This commit is contained in:
Ironsp
2026-06-26 14:04:41 +08:00
parent f92baab6f7
commit 8bd41d6758

View File

@@ -1,4 +1,5 @@
import Hls from 'hls.js';
import { log } from 'node:console';
let hlsInstance: Hls | null = null;
// let hlsRetryCount = 0;
@@ -92,7 +93,9 @@ export const destroyHls = (monitorVideoRef) => {
video.removeAttribute('src');
// 对某些浏览器,需要调用 load() 来重置 media element
if (typeof video.load === 'function') video.load();
} catch (e) {}
} catch (e) {
console.log('Error in destroyHls:', e);
}
}
};