Browse Source

added message if peerconnection is not supported

Dennis Mårtensson 12 years ago
parent
commit
b1b45428c7
3 changed files with 15 additions and 7 deletions
  1. 12 6
      example/index.html
  2. 2 0
      example/server.js
  3. 1 1
      package.json

+ 12 - 6
example/index.html

@@ -22,6 +22,8 @@
     </div>
     <script>
       var videos = [];
+      var rooms = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
+      var PeerConnection = window.PeerConnection || window.webkitPeerConnection00;
 
       function getNumPerRow() {
         var len = videos.length;
@@ -139,15 +141,19 @@
       }
 
       function init() {
-        rtc.createStream('you', function(stream) {
-          videos.push(document.getElementById('you'));
-          rtc.attachStream(stream, 'you');
-          subdivideVideos();
-        });
+        if(PeerConnection){
+          rtc.createStream('you', function(stream) {
+            videos.push(document.getElementById('you'));
+            rtc.attachStream(stream, 'you');
+            subdivideVideos();
+          });
+        }else {
+          alert('Your browser is not supported or you have to turn on flags. In chrome you go to chrome://flags and turn on Enable PeerConnection remember to restart chrome');
+        }
 
         
         var room = window.location.hash.slice(1);
-        var rooms = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
+
         if (room === '') {
             room = Math.floor(Math.random()*rooms.length);
             window.location.hash = room;

+ 2 - 0
example/server.js

@@ -4,6 +4,8 @@ var io = require('webrtc.io').listen(app);
 var colors = {};
 var servers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
 
+
+
 //When connectiong to nodejitsu
 //app.listen(80);
 

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "MultiWebRTC",
   "description": "Example of multi user webrtc",
-  "version": "0.0.1-18",
+  "version": "0.0.1-23",
   "engines": {
     "node": ">= 0.6.0"
   },