Skip to content

Commit 4a750d7

Browse files
committed
Add Incoming Video Modal
1 parent 1bf4546 commit 4a750d7

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

resources/assets/js/components/ChatRoom.vue

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,25 @@
4242
</div>
4343
</div>
4444
<div class="col-md-6">
45-
<video-section></video-section>
45+
<video-section></video-section>
46+
</div>
47+
48+
<div id="incomingVideoCallModal" class="modal fade" role="dialog">
49+
<div class="modal-dialog">
50+
51+
<!-- Modal content-->
52+
<div class="modal-content">
53+
<div class="modal-header">
54+
<button type="button" class="close" data-dismiss="modal">&times;</button>
55+
<h4 class="modal-title">Incoming Call</h4>
56+
</div>
57+
<div class="modal-footer">
58+
<button type="button" id="answerCallButton" class="btn btn-success">Answer</button>
59+
<button type="button" id="denyCallButton" data-dismiss="modal" class="btn btn-danger">Deny</button>
60+
</div>
61+
</div>
62+
63+
</div>
4664
</div>
4765
</div>
4866
</template>
@@ -51,6 +69,9 @@
5169
$(function () {
5270
var localVideo = document.getElementById('localVideo');
5371
var remoteVideo = document.getElementById('remoteVideo');
72+
var answerButton = document.getElementById('answerCallButton');
73+
74+
answerButton.onclick = answerCall;
5475
});
5576
5677
var conversationID;
@@ -155,19 +176,14 @@
155176
console.log('unknown signal type ' + m.subtype);
156177
}
157178
}
158-
179+
159180
function onSignalClose() {
160181
trace('Ending call');
161182
pc.close();
162183
pc = null;
163184
164185
closeMedia();
165186
clearView();
166-
167-
//Send candidate to remote side
168-
conversationID = Cookies.get('conversationID');
169-
var message = {from: luid, to:ruid, type: 'signal', subtype: 'close', content: 'close', time:new Date()};
170-
axios.post('/trigger/' + conversationID , message );
171187
}
172188
173189
function closeMedia(){
@@ -211,13 +227,14 @@
211227
212228
function onSignalOffer(offer){
213229
Cookies.set('offer', offer);
214-
answerCall();
230+
$('#incomingVideoCallModal').modal('show');
215231
}
216232
217233
function answerCall() {
218234
isCaller = false;
219235
luid = Cookies.get('uuid');
220236
ruid = Cookies.get('remoteUUID');
237+
$('#incomingVideoCallModal').modal('hide');
221238
start()
222239
}
223240
@@ -243,10 +260,10 @@
243260
}
244261
}
245262
})
246-
.then(gotStream)
247-
.catch(function(e) {
248-
alert('getUserMedia() error: ' + e.name);
249-
});
263+
.then(gotStream)
264+
.catch(function(e) {
265+
alert('getUserMedia() error: ' + e.name);
266+
});
250267
}
251268
252269
function call() {

0 commit comments

Comments
 (0)