diff --git a/src/core/janus/index.js b/src/core/janus/index.js index 28432d6..225cd00 100644 --- a/src/core/janus/index.js +++ b/src/core/janus/index.js @@ -1,5 +1,5 @@ import Janus from 'janus-gateway' -import { onMounted, ref } from 'vue' +import { onMounted, onUnmounted, ref } from 'vue' import adapter from 'webrtc-adapter' export { @@ -122,6 +122,11 @@ export function useJanus(options) { await start() }) + onUnmounted(async () => { + await stop(); + cleanup(); + }) + const StreamPlugin = () => { const opaqueId = `streamingtest-${Janus.randomString(12)}` return {