Skip to content

Commit c729e52

Browse files
committed
fix: destroy hls on unmount
1 parent 329b832 commit c729e52

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ui/src/components/VideoStream.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import Hls from 'hls.js';
3-
import { onMounted, ref } from 'vue';
3+
import { onMounted, onUnmounted, ref } from 'vue';
44
55
const video = ref(null);
66
@@ -26,6 +26,9 @@ onMounted(() => {
2626
elVideo.play();
2727
});
2828
});
29+
onUnmounted(() => {
30+
hls.destroy();
31+
});
2932
} else if (elVideo.canPlayType('application/vnd.apple.mpegurl')) {
3033
elVideo.src = props.source;
3134
elVideo.addEventListener('loadedmetadata',function() {

0 commit comments

Comments
 (0)