Skip to content

Commit

Permalink
Add Incoming Video Modal
Browse files Browse the repository at this point in the history
  • Loading branch information
PHPJunior committed Oct 24, 2017
1 parent 1bf4546 commit 4a750d7
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions resources/assets/js/components/ChatRoom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,25 @@
</div>
</div>
<div class="col-md-6">
<video-section></video-section>
<video-section></video-section>
</div>

<div id="incomingVideoCallModal" class="modal fade" role="dialog">
<div class="modal-dialog">

<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Incoming Call</h4>
</div>
<div class="modal-footer">
<button type="button" id="answerCallButton" class="btn btn-success">Answer</button>
<button type="button" id="denyCallButton" data-dismiss="modal" class="btn btn-danger">Deny</button>
</div>
</div>

</div>
</div>
</div>
</template>
Expand All @@ -51,6 +69,9 @@
$(function () {
var localVideo = document.getElementById('localVideo');
var remoteVideo = document.getElementById('remoteVideo');
var answerButton = document.getElementById('answerCallButton');
answerButton.onclick = answerCall;
});
var conversationID;
Expand Down Expand Up @@ -155,19 +176,14 @@
console.log('unknown signal type ' + m.subtype);
}
}
function onSignalClose() {
trace('Ending call');
pc.close();
pc = null;
closeMedia();
clearView();
//Send candidate to remote side
conversationID = Cookies.get('conversationID');
var message = {from: luid, to:ruid, type: 'signal', subtype: 'close', content: 'close', time:new Date()};
axios.post('/trigger/' + conversationID , message );
}
function closeMedia(){
Expand Down Expand Up @@ -211,13 +227,14 @@
function onSignalOffer(offer){
Cookies.set('offer', offer);
answerCall();
$('#incomingVideoCallModal').modal('show');
}
function answerCall() {
isCaller = false;
luid = Cookies.get('uuid');
ruid = Cookies.get('remoteUUID');
$('#incomingVideoCallModal').modal('hide');
start()
}
Expand All @@ -243,10 +260,10 @@
}
}
})
.then(gotStream)
.catch(function(e) {
alert('getUserMedia() error: ' + e.name);
});
.then(gotStream)
.catch(function(e) {
alert('getUserMedia() error: ' + e.name);
});
}
function call() {
Expand Down

0 comments on commit 4a750d7

Please sign in to comment.