feat: 增加清理

This commit is contained in:
wangyu 2023-12-18 09:45:14 +08:00
parent 130a2b04f1
commit ba65bed9d2
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import Janus from 'janus-gateway' import Janus from 'janus-gateway'
import { onMounted, ref } from 'vue' import { onMounted, onUnmounted, ref } from 'vue'
import adapter from 'webrtc-adapter' import adapter from 'webrtc-adapter'
export { export {
@ -122,6 +122,11 @@ export function useJanus(options) {
await start() await start()
}) })
onUnmounted(async () => {
await stop();
cleanup();
})
const StreamPlugin = () => { const StreamPlugin = () => {
const opaqueId = `streamingtest-${Janus.randomString(12)}` const opaqueId = `streamingtest-${Janus.randomString(12)}`
return { return {