0

How to detect headphone and cam when calling start recording function in recordRTC liabrary.

btnStartRecording.onclick = function() {

  btnStartRecording.disabled = true;
  captureUserMedia(function(stream) {

      mediaStream = stream;
      videoElement.src = window.URL.createObjectURL(stream);
      videoElement.play();
      videoElement.muted = true;
      videoElement.controls = false;
      // it is second parameter of the RecordRTC
      var audioConfig = {};
      if (!isRecordOnlyAudio) {
          audioConfig.onAudioProcessStarted = function() {
              // invoke video recorder in this callback
              // to get maximum sync
              videoRecorder.startRecording();
          };
      }

      audioRecorder = RecordRTC(stream, audioConfig);

      if (!isRecordOnlyAudio) {
          // it is second parameter of the RecordRTC
          var videoConfig = {type: 'video'};
          videoRecorder = RecordRTC(stream, videoConfig);
      }

      audioRecorder.startRecording();
      // enable stop-recording button
      btnStopRecording.disabled = false;
  });
};

If any method in captureUserMedia that detects devices and return error message.

xdumaine
  • 10,096
  • 6
  • 62
  • 103
Mustafa bw
  • 1,290
  • 3
  • 12
  • 21
  • use the `enumerateDevices` api. http://stackoverflow.com/questions/14610945/how-to-choose-input-video-device-for-webrtc – Benjamin Trent Sep 10 '15 at 14:58
  • 1
    Your question is not very clear. Are you trying to determine *which* device is used? Are you trying to *change* which device is used? Are you trying to determine *if* devices are available? – xdumaine Sep 10 '15 at 22:31
  • I am trying to determine that device is exist or not – Mustafa bw Sep 11 '15 at 11:07

0 Answers0