1

This is my client.js

navigator.getUserMedia(constraints, successCallback, errorCallback);
function successCallback (stream) { //I want to pass the stream variable to server-side NodeJS
   var video = document.querySelector('video');
   video.src = window.URL.createObjectURL(stream);
   video.onloadedmetadata = function(e) {
      // Do something with the video here.
   };
}
//...

This is my server.js

var PitchDetect = require('pitch-detect'),
    pitchDetect = new PitchDetect(stream); // I want to get the stream variable from client.js

pitchDetect.getPitch();

How to tell nodeJS that in server.js file, the stream variable is the same as stream variable from client.js ?

J. Doe
  • 11
  • 1
  • Possible duplicate of [What is the difference between client-side and server-side programming?](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – Quentin Jun 07 '17 at 14:11
  • You can't. They are different programs (probably) running on different computers. They don't share variables. – Quentin Jun 07 '17 at 14:12
  • Yes, but to achieve what I want, What must I do ? An http request ? – J. Doe Jun 07 '17 at 14:13

0 Answers0