|
@@ -101,14 +101,14 @@ watch(
|
|
|
}
|
|
|
);
|
|
|
|
|
|
-watch(
|
|
|
- () => isJoined.value,
|
|
|
- () => {
|
|
|
- if (!isJoined.value) {
|
|
|
- handleLeave();
|
|
|
- }
|
|
|
- }
|
|
|
-);
|
|
|
+// watch(
|
|
|
+// () => isJoined.value,
|
|
|
+// () => {
|
|
|
+// if (!isJoined.value) {
|
|
|
+// handleLeave();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// );
|
|
|
|
|
|
TRTC.checkSystemRequirements().then((checkResult) => {
|
|
|
if (!checkResult.result) {
|
|
@@ -235,7 +235,9 @@ async function handleUnpublish() {
|
|
|
try {
|
|
|
await localClient.unpublish(localStream);
|
|
|
store.commit("rtc/setIsPublished", false);
|
|
|
- } catch (error) {}
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error, "-----------handleUnpublish--------------");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
async function handleLeave() {
|
|
@@ -245,17 +247,24 @@ async function handleLeave() {
|
|
|
try {
|
|
|
uninstallEventHandlers();
|
|
|
await localClient.leave();
|
|
|
+ localClient.destroy();
|
|
|
+ localClient = null;
|
|
|
+ invitedRemoteStreams.value.forEach((item) => {
|
|
|
+ item.stop();
|
|
|
+ });
|
|
|
invitedRemoteStreams.value = [];
|
|
|
store.commit("rtc/setVideoDeviceId", "");
|
|
|
store.commit("rtc/setAudioDeviceId", "");
|
|
|
|
|
|
if (localStream) {
|
|
|
- console.log('有执行到这里-------------');
|
|
|
localStream.stop();
|
|
|
localStream.close();
|
|
|
localStream = null;
|
|
|
+ console.log("有执行到这里-------------");
|
|
|
}
|
|
|
- } catch (error) {}
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error, "-----------handleLeave--------------");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function installEventHandlers() {
|
|
@@ -371,6 +380,7 @@ async function handleStreamSubscribed(event) {
|
|
|
if (remoteStream.userId_ == store.getters["rtc/userId"]) {
|
|
|
return;
|
|
|
}
|
|
|
+ console.error(remoteStream.userId_, store.getters["rtc/userId"], "handleStreamSubscribedhandleStreamSubscribed.value");
|
|
|
|
|
|
if (!invitedRemoteStreams.value.some((item) => item.userId_ == remoteStream.userId_)) {
|
|
|
invitedRemoteStreams.value.push(remoteStream);
|
|
@@ -424,9 +434,9 @@ let switchDevice = async ({ videoId, audioId }) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-onUnmounted(()=>{
|
|
|
- handleLeave()
|
|
|
-})
|
|
|
+onUnmounted(() => {
|
|
|
+ handleLeave();
|
|
|
+});
|
|
|
|
|
|
let canUseDevice = () => {
|
|
|
console.log("可用");
|