topical media & game development

talk show tell print

mobile-query-three-plugins-webrtcio-examples-purereceiver.htm / htm



  <!doctype html><title>Minimal tQuery Page</title>
  <script src="../../../build/tquery-bundle-require.js"></script>
  <script src='../vendor/webrtc.io-client/webrtc.io.js'></script>
  <script src='../tquery.webrtc.js'></script>
  <body><script>
  require(['tquery.videos'], function(){
          var world        = tQuery.createWorld().boilerplate().start();
  
          var room        = 'public';
          var serverUrl        = "ws://localhost:8080/";
          rtc.connect(serverUrl, room);
          rtc.on('add remote stream', function(mediaStream, socketId) {
                  console.log('add socketId', socketId)
                  tQuery.createPlane().addTo(world)
                          .addClass('socketId-'+socketId)
                          .positionX(2 * Math.random()-0.5)
                          .positionY(2 * Math.random()-0.5)
                          .setBasicMaterial()
                                  .map(mediaStream)
                                  .back()             
          });
          rtc.on('disconnect stream', function(socketId) {
                  var nRemote        = tQuery('.socketId-'+socketId).length;
                  console.log('remove',socketId,'currently', nRemote);
                  tQuery('.socketId-'+socketId).detach();
          });
  });
  </script></body>


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.