topical media & game development

talk show tell print

mobile-query-three-plugins-webrtcio-tquery.webrtc.js / js



  
hook tQuery.convert.toTexture() to accept MediaStream

  
  tQuery.convert.toTexture.addEventListener('preConvert', function(args){
          // if first args IS NOT a LocalMediaStream, return now
          //if( args[0] instanceof LocalMediaStream === false )        return undefined;
          
          // FIXME window.LocalMediaStream is not defined... so impossible to do instanceof
          // - working around by testing properties which MUST exist in a MediaLocalStream
          // - aka a poor version of it
          if( args[0].audioTracks === undefined )        return;
          if( args[0].videoTracks === undefined )        return;
          if( args[0].readyState  === undefined )        return;
          // now convert the stream in a texture using tquery.videos plugin
          var stream        = args[0];
          var url                = URL.createObjectURL(stream);
          var texture        = tQuery.createVideoTexture(url);
          return texture;
  });
  


(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.