|
4 | 4 | <title>WebRTC Peer Connections</title>
|
5 | 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
6 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1">
|
| 7 | + <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"> |
| 8 | + <link href="css/styles.css" rel="stylesheet" type="text/css"> |
7 | 9 | </head>
|
8 | 10 | <body>
|
9 | 11 |
|
10 |
| -<input id="number" value="425-888-1234"> |
11 |
| -<button id="dial">Call Phone</button> |
| 12 | +<!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= --> |
| 13 | +<!-- My Phone Number & Dial Areas --> |
| 14 | +<!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= --> |
| 15 | +<div class="container"> |
| 16 | + <div class="row"> |
| 17 | + <!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= --> |
| 18 | + <!-- MY PHONE NUMBER --> |
| 19 | + <!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= --> |
| 20 | + <div class="col-sm-6"> |
| 21 | + <div id="my-number-section" class="text-center"> |
| 22 | + <div id="my-number">LOADING</div> |
| 23 | + <div id="my-number-title"> |
| 24 | + call me. this is my phone number. |
| 25 | + </div> |
| 26 | + </div> |
| 27 | + </div> |
| 28 | + |
| 29 | + <!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= --> |
| 30 | + <!-- MY PHONE NUMBER --> |
| 31 | + <!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= --> |
| 32 | + <div class="col-sm-6"> |
| 33 | + <!-- DISPLAY --> |
| 34 | + <div id="video-display"> |
| 35 | + <span class="glyphicon glyphicon-facetime-video"></span> |
| 36 | + </div> |
| 37 | + |
| 38 | + <!-- DIAL CONTROLS --> |
| 39 | + <div class="row"> |
| 40 | + <div class="col-xs-4"> |
| 41 | + <div class="form-group"><div class="input-group"> |
| 42 | + <div class="input-group-addon"> |
| 43 | + <span class="glyphicon glyphicon-earphone"></span> |
| 44 | + </div> |
| 45 | + <input id="number" class="form-control" placeholder="..."> |
| 46 | + </div></div> |
| 47 | + </div><div class="col-xs-3"> |
| 48 | + <button id="dial" class="btn btn-primary">Call Friend</button> |
| 49 | + </div></div> |
| 50 | + </div> |
| 51 | + </div> |
| 52 | +</div> |
| 53 | + |
| 54 | +<!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= --> |
| 55 | +<!-- TODO --> |
| 56 | +<!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= --> |
| 57 | + |
| 58 | +<div class="container"> |
| 59 | + <div class="row"> |
| 60 | + <div class="col-xs-6"> |
| 61 | + <ol> |
| 62 | + <li> resend SDP periodically and dedupe |
| 63 | + <li> |
| 64 | + <li> |
| 65 | + </ol> |
| 66 | + </div> |
| 67 | + <div class="col-xs-6"> |
| 68 | + <ol> |
| 69 | + <li> resend SDP periodically and dedupe |
| 70 | + <li> |
| 71 | + <li> |
| 72 | + </ol> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | +</div> |
| 76 | + |
12 | 77 |
|
13 | 78 | <!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -->
|
14 | 79 | <!-- WebRTC Peer Connections -->
|
15 | 80 | <!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -->
|
16 | 81 | <script src="https://cdn.pubnub.com/pubnub.min.js"></script>
|
17 |
| -<script src="webrtc.js"></script> |
18 |
| -<script src="sound.js"></script> |
| 82 | +<script src="js/webrtc.js"></script> |
| 83 | +<script src="js/sound.js"></script> |
19 | 84 | <script>(function(){
|
20 | 85 |
|
| 86 | +// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
| 87 | +// Random Number |
| 88 | +// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
| 89 | +var my_number = PUBNUB.$('my-number'); |
| 90 | +my_number.number = Math.floor(Math.random()*1000); |
| 91 | +my_number.innerHTML = ''+my_number.number; |
| 92 | + |
21 | 93 | // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
22 | 94 | // Calling & Answering Service
|
23 | 95 | // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
24 | 96 | var phone = PHONE({
|
25 |
| - phone : '425-888-1234', // listen on this line |
| 97 | + phone : my_number.number, // listen on this line |
26 | 98 | publish_key : 'pub-c-561a7378-fa06-4c50-a331-5c0056d0163c',
|
27 | 99 | subscribe_key : 'sub-c-17b7db8a-3915-11e4-9868-02ee2ddab7fe',
|
28 | 100 | ssl : true,
|
|
34 | 106 | // Ready to Send or Receive Calls
|
35 | 107 | // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
36 | 108 | phone.ready(function(response){
|
| 109 | + // Bind Button Click |
37 | 110 | PUBNUB.bind( 'click', PUBNUB.$('dial'), function() {
|
38 | 111 |
|
39 | 112 | // Make a Phone Call
|
40 | 113 | phone.dial({
|
41 |
| - number : PUBNUB.$("number").value, |
42 |
| - establish : function(session){}, |
43 |
| - disconnect : function(session){} |
| 114 | + number : PUBNUB.$("number").value, |
| 115 | + connect : function(session){}, |
| 116 | + hangup : function(session){} |
44 | 117 | });
|
45 | 118 |
|
46 | 119 | } );
|
|
0 commit comments