Coder Social home page Coder Social logo

faizanarif121 / vue-record Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codekraft-studio/vue-record

0.0 0.0 0.0 1.27 MB

VueJs components for MediaRecorder API

Home Page: https://codekraft-studio.github.io/vue-record/

License: MIT License

JavaScript 61.14% HTML 2.64% Vue 36.22%

vue-record's Introduction

vue-record

custom components for MediaRecorder API

NPM version Dependency Status License

Checkout the demo to see it in action.

Installation

Download the project using your favourite package manager:

npm install @codekraft-studio/vue-record

Load it inside your project and use it:

import Vue from 'vue'
import VueRecord from '@codekraft-studio/vue-record'

Vue.use(VueRecord)

Now you have access to the global defined components, here an example:

<VueRecordAudio />
<VueRecordVideo />

Usage

Use the components in your template with different modes and properties to customize the behavior and the recording output.

Both of the provided components can be used as the following pseudo code example:

<Component :mode="recMode" @stream="onStream" @result="onResult" />

Modes

The are only two usage modes and can be selected with the mode property:

  • hold: Hold is the default mode and it means the recording start when the button is clicked or pressed and stops when is released, basically it record only when holding the button.
  • press: Press will start the recording once the button is pressed and it will stop the recording when the button is pressed again, so it will record until stopped.

Events

  • stream: The stream event is emitted when the user media device stream is captured and contains the original MediaStream object.
  • result: The result event is emitted once a recording has been completed and contains the Blob data of the recording.

By default it's on hold mode, so the recording start when the button is pressed and stops when the button is released. But you can change this behaviour using a different mode, the available modes are: hold and press.


Examples

Recording Audio

It's simple as adding the component and listening for the result event:

<vue-record-audio @result="onResult" />
export default {
  methods: {
    onResult (data) {
      console.log('The blob data:', data);
      console.log('Downloadable audio', window.URL.createObjectURL(data));
    }
  }
}

We're using this polyfill for Safari.

Recording Video

It's simple as adding the component and listening for the result event:

<vue-record-video @result="onResult" />
export default {
  methods: {
    onResult (data) {
      console.log('The blob data:', data);
      console.log('Downloadable video', window.URL.createObjectURL(data));
    }
  }
}

It doesn't work on Safari, we should consider this polyfill.


License

Released with MIT License © codekraft-studio

vue-record's People

Contributors

lidio601 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.