Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

javascript
communitycreator

How to install JavaScript Media Recorder

Muhammad Hameed

The MeadiaRecorder is an interface that uses MediaStream Recording API to record media. This interface is activated when the QBMediaRecorder() constructor is called.

widget

Installation

Node package manager

We can install MediaRecorder using npm install:

npm install media-recorder-js --save

CDN

We can use CDN to install MediaRecorder:

<script src='https://unpkg.com/media-recorder-js/mediaRecorder.js'></script>

We can also download it directly from Github:

You need to have a gulp.js for this method.

npm i

npm run build

Initial set-up

You have to create a QBMediaRecorder() object with some predefined functions:

var config = {
    // use named function
    onstart: function onStart() {
        console.log('Starting Recorder');
    },
    onstop: function onStop(Blob) {
        videoElement.src = URL.createObjectURL(blob);
    },
    // 'audio/mp3'
    mimeType: 'audio/mp3',
    // set relative path (from folder node_modules for example)
    workerPath: '../node_modules/javascript-media-recorder/qbAudioRecorderWorker.js'
};

// uses as global variable, QBMediaRecorder is built as a UMD module.
var recorder = new QBMediaRecorder(config);

RELATED TAGS

javascript
communitycreator
RELATED COURSES

View all Courses

Keep Exploring