|
42 | 42 | </div> |
43 | 43 | </div> |
44 | 44 | <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">×</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> |
46 | 64 | </div> |
47 | 65 | </div> |
48 | 66 | </template> |
|
51 | 69 | $(function () { |
52 | 70 | var localVideo = document.getElementById('localVideo'); |
53 | 71 | var remoteVideo = document.getElementById('remoteVideo'); |
| 72 | + var answerButton = document.getElementById('answerCallButton'); |
| 73 | +
|
| 74 | + answerButton.onclick = answerCall; |
54 | 75 | }); |
55 | 76 |
|
56 | 77 | var conversationID; |
|
155 | 176 | console.log('unknown signal type ' + m.subtype); |
156 | 177 | } |
157 | 178 | } |
158 | | - |
| 179 | +
|
159 | 180 | function onSignalClose() { |
160 | 181 | trace('Ending call'); |
161 | 182 | pc.close(); |
162 | 183 | pc = null; |
163 | 184 |
|
164 | 185 | closeMedia(); |
165 | 186 | 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 ); |
171 | 187 | } |
172 | 188 |
|
173 | 189 | function closeMedia(){ |
|
211 | 227 |
|
212 | 228 | function onSignalOffer(offer){ |
213 | 229 | Cookies.set('offer', offer); |
214 | | - answerCall(); |
| 230 | + $('#incomingVideoCallModal').modal('show'); |
215 | 231 | } |
216 | 232 |
|
217 | 233 | function answerCall() { |
218 | 234 | isCaller = false; |
219 | 235 | luid = Cookies.get('uuid'); |
220 | 236 | ruid = Cookies.get('remoteUUID'); |
| 237 | + $('#incomingVideoCallModal').modal('hide'); |
221 | 238 | start() |
222 | 239 | } |
223 | 240 |
|
|
243 | 260 | } |
244 | 261 | } |
245 | 262 | }) |
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 | + }); |
250 | 267 | } |
251 | 268 |
|
252 | 269 | function call() { |
|
0 commit comments