Browse Source

dev-3

Added decline and accept options
QueennN 4 years ago
parent
commit
c8a336e8a3
2 changed files with 15 additions and 1 deletions
  1. 11 0
      src/App.vue
  2. 4 1
      src/components/acceptcall.vue

+ 11 - 0
src/App.vue

@@ -20,8 +20,19 @@ export default {
         -1
       )
         return false;
+
       call.on("close", () => {
         console.log("call closed");
+        let index = this.$store.state.receiveCalls.findIndex(
+          (r) => r.peer == call.peer
+        );
+         this.$store.state.receiveCalls[index].close()
+        this.$store.state.receiveCalls.splice(index, 1);
+        
+        index = this.$store.state.remoteStreams.findIndex(
+          (r) => r.peer == call.peer
+        );
+        this.$store.state.remoteStreams.splice(index, 1);
       });
 
       call.on("stream", (remoteStream) => {

+ 4 - 1
src/components/acceptcall.vue

@@ -2,7 +2,7 @@
   <div>
     <div>{{call.peer}}</div>
     <b-button variant="success" @click="call.answer($store.state.myLocalVideoStream);">Accept Call</b-button>
-    <b-button variant="danger">Decline Call</b-button>
+    <b-button variant="danger" @click="closeCall()">Decline or Close Call</b-button>
   </div>
 </template>
 
@@ -13,6 +13,9 @@ export default {
     return {};
   },
   methods: {
+    closeCall:function(){
+      this.call.close()
+    }
   },
 };
 </script>