How to use recordrtc - 10 common examples

To help you get started, we’ve selected a few recordrtc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github collab-project / videojs-record / src / js / engine / record-rtc.js View on Github external
break;

            case ANIMATION:
                internal = this.engine.gifRecorder;
                break;

            default:
                internal = this.engine.videoRecorder;
        }

        let maxFileSizeReached = false;
        if (internal) {
            internal = internal.getInternalRecorder();
        }

        if ((internal instanceof RecordRTC.MediaStreamRecorder) === true) {
            this.player().recordedData = internal.getArrayOfBlobs();

            // inject file info for newest blob
            this.addFileInfo(
                this.player().recordedData[this.player_.recordedData.length - 1]);

            // check max file size
            if (this.maxFileSize > 0) {
                let currentSize = new Blob(this.player().recordedData).size;
                if (currentSize >= this.maxFileSize) {
                    maxFileSizeReached = true;
                }
            }
        }

        // notify others
github collab-project / videojs-record / src / js / engine / record-rtc.js View on Github external
setup(stream, mediaType, debug) {
        this.inputStream = stream;
        this.mediaType = mediaType;
        this.debug = debug;

        if ('screen' in this.mediaType) {
            this.mediaType.video = true;
        }

        // recorder type
        if (this.recorderType !== undefined) {
            this.mediaType.video = this.recorderType;
        }

        // setup RecordRTC
        this.engine = new RecordRTC.MRecordRTC();
        this.engine.mediaType = this.mediaType;
        this.engine.disableLogs = !this.debug;
        this.engine.mimeType = this.mimeType;

        // audio settings
        this.engine.bufferSize = this.bufferSize;
        this.engine.sampleRate = this.sampleRate;
        this.engine.numberOfAudioChannels = this.audioChannels;

        // video/canvas settings
        this.engine.video = this.video;
        this.engine.canvas = this.canvas;
        this.engine.bitrate = this.bitRate;

        // animated gif settings
        this.engine.quality = this.quality;
github surveyjs / widgets / src / microphone.js View on Github external
var successCallback = function(stream) {
        var options = {
          type: "audio",
          mimeType: "audio/webm",
          audioBitsPerSecond: 44100,
          sampleRate: 44100,
          bufferSize: 16384,
          numberOfAudioChannels: 1
        };
        console.log("successCallback");
        question.survey.mystream = stream;
        question.survey.recordRTC = RecordRTC(
          question.survey.mystream,
          options
        );
        if (typeof question.survey.recordRTC != "undefined") {
          console.log("startRecording");
          question.survey.recordRTC.startRecording();
        }
      };
github kasprownik / electron-screencapture / index.js View on Github external
const startRecording = ({canvas, video, x, y, width, height, availTop}) => {
  const recorder = RecordRTC(canvas, {type: 'canvas'});
  const ctx = canvas.getContext('2d');
  const stopLoop = getLoop(() => drawFrame({ctx, video, x, y, width, height, availTop}));

  recorder.startRecording();

  return {
    stop() {
      return new Promise(resolve => {
        stopLoop();
        recorder.stopRecording(() => {
          recorder.getDataURL(url => resolve({url, width, height}));
        });
      });
    },
    pause() {
      recorder.pauseRecording();
github quanglam2807 / translatium / src / state / pages / home / speech / actions.js View on Github external
navigator.getUserMedia({ audio: true, video: false }, (stream) => {
        recorder = new RecordRTC(stream, {
          recorderType: RecordRTC.StereoAudioRecorder,
          type: 'audio',
          audioType: 'audio/wav',
          mimeType: 'audio/wav',
          sampleRate: 44100,
          numberOfAudioChannels: 1,
        });

        recorder.setRecordingDuration(DURATION).onRecordingStopped(() => {
          dispatch(stopRecording());
        });

        recorder.startRecording();
      }, () => {
        dispatch(openAlert('cannotActivateMicrophone'));
github szwang / recordrtc-react / src / RecordPage.react.js View on Github external
captureUserMedia((stream) => {
      this.setState({ mediaStream: stream });

      this.state.recordVideo = RecordRTC(stream, {
        type: 'video'
      });

      this.state.recordVideo.startRecording();
    });
github ralscha / blog / speechsearch / client / src / app / home / home.page.ts View on Github external
headers,
            method: 'POST',
            body: recordedBlob
          };
          const response = await fetch(`${environment.serverUrl}/uploadSpeech`, requestParams);
          const searchTerms = await response.json();
          this.movieSearch(searchTerms);
      });
  }
      this.isRecording = false;
    } else {
      this.isRecording = true;
      const stream = await navigator.mediaDevices.getUserMedia({video: false, audio: true});
      const options = {
        mimeType: 'audio/wav',
        recorderType: RecordRTC.StereoAudioRecorder
      };
      this.recorder = RecordRTC(stream, options);
      this.recorder.startRecording();
    }
  }
github AASHISHAG / DeepSpeech-API / frontend / src / app / app.component.ts View on Github external
successCallback(stream) {
        var options = {
            mimeType: "audio/wav",
            numberOfAudioChannels: 1
        };
        //Start Actuall Recording
        var StereoAudioRecorder = RecordRTC.StereoAudioRecorder;
        this.record = new StereoAudioRecorder(stream, options);
        this.record.record();
    }
github quanglam2807 / translatium / src / state / pages / home / speech / actions.js View on Github external
navigator.getUserMedia({ audio: true, video: false }, (stream) => {
        recorder = new RecordRTC(stream, {
          recorderType: RecordRTC.StereoAudioRecorder,
          type: 'audio',
          audioType: 'audio/wav',
          mimeType: 'audio/wav',
          sampleRate: 44100,
          numberOfAudioChannels: 1,
        });

        recorder.setRecordingDuration(DURATION).onRecordingStopped(() => {
          dispatch(stopRecording());
        });

        recorder.startRecording();
      }, () => {
        dispatch(openAlert('cannotActivateMicrophone'));
github ralscha / blog / uploadflowjs / client / src / app / home / home.page.ts View on Github external
.then(async (stream) => {
        this.videoElement.nativeElement.srcObject = stream;
        await this.videoElement.nativeElement.play();

        const options = {
          mimeType: 'video/webm\;codecs=vp9',
          recorderType: RecordRTC.MediaStreamRecorder
        };
        this.recordRTC = RecordRTC(stream, options);
        this.recordRTC.startRecording();

      })
      .catch(function (err) {

recordrtc

RecordRTC is a server-less (entire client-side) JavaScript library that can be used to record WebRTC audio/video media streams. It supports cross-browser audio/video recording.

MIT
Latest version published 4 years ago

Package Health Score

64 / 100
Full package analysis