Explorar o código

Prevent auto-hangup on pro side (when everyone else leaves)

Vijayakrishnan %!s(int64=5) %!d(string=hai) anos
pai
achega
dabcdbcc01

+ 7 - 7
resources/views/client-dashboard.blade.php

@@ -202,13 +202,13 @@
                         if(!$('[data-stream]:not([data-stream="' + self.selfStreamId + '"])').length) {
                             // self.hangUp();
                             console.warn('No other parties in the call!');
-                            new Noty({
-                                theme: 'mint',
-                                type: 'info',
-                                text: 'All other participants have left the call',
-                                progressBar: false,
-                                timeout: 2500,
-                            }).show();
+                            // new Noty({
+                            //     theme: 'mint',
+                            //     type: 'info',
+                            //     text: 'All other participants have left the call',
+                            //     progressBar: false,
+                            //     timeout: 2500,
+                            // }).show();
                             self.startTime = 0;
                             self.started = false;
                             self.noOneElseInCall = true;

+ 18 - 9
resources/views/pro-call.blade.php

@@ -23,6 +23,11 @@
             <div class="py-3 text-center" v-if="started">
                 <h6 class="text-black font-weight-bold m-0">Call in progress: @{{ timeDisplay() }}</h6>
             </div>
+            <div class="py-3 text-center" v-if="noOneElseInCall">
+                <h6 class="text-black font-weight-bold m-0">No other participants in the call.
+                    <a href="#" class="text-danger font-weight-bold" v-on:click.prevent="hangUp()">Hang up</a>
+                </h6>
+            </div>
             <div class="main-view mx-auto">
                 <div id="self-view" class="full-view" data-name="{{ $pro->name_display }}" data-type="PRO"></div>
                 <div class="thumbs">
@@ -65,6 +70,7 @@
 
                 selfUserType: 'PRO',
                 selfStreamId: '',
+                noOneElseInCall: true,
                 patientInQueue: false,
 
                 videoActive: false,
@@ -209,6 +215,8 @@
                         }
 
                         self.activateParty(event.stream.id);
+
+                        self.noOneElseInCall = false;
                     });
 
                     // peer disconnected
@@ -239,7 +247,7 @@
                                 });
                             }
                             else {
-                                self.hangUp();
+                                self.noOneElseInCall = true;
                             }
                         }
 
@@ -264,16 +272,17 @@
                         if(!$('[data-stream]:not([data-stream="' + self.selfStreamId + '"])').length) {
                             // self.hangUp();
                             console.warn('No other parties in the call!');
-                            new Noty({
-                                theme: 'mint',
-                                type: 'info',
-                                text: 'All other participants have left the call',
-                                progressBar: false,
-                                timeout: 2500,
-                            }).show();
+                            // new Noty({
+                            //     theme: 'mint',
+                            //     type: 'info',
+                            //     text: 'All other participants have left the call',
+                            //     progressBar: false,
+                            //     timeout: 2500,
+                            // }).show();
                             self.startTime = 0;
                             self.started = false;
-                            self.hangUp();
+                            // self.hangUp();
+                            self.noOneElseInCall = true;
                         }
                     }