Build VueJs components for MediaRecorder API

Build VueJs components for MediaRecorder API

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:

<vue-record-audio />
<vue-record-video />

Usage

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

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));
    }
  }
}

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 audio', window.URL.createObjectURL(data));
    }
  }
}

GitHub

Thanks for reading !

vuejs vue javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

8 Popular Websites That Use The Vue.JS Framework

In this article, we are going to list out the most popular websites using Vue JS as their frontend framework. Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.

Vue Native is a framework to build cross platform native mobile apps using JavaScript

Vue Native is a framework to build cross platform native mobile apps using JavaScript. It is a wrapper around the APIs of React Native. So, with Vue Native, you can do everything that you can do with React Native. With Vue Native, you get

Creating a Custom Tooltip Component in Vue

There are plenty of libraries out there that will have you up and running with a good tooltip solution in minutes. However, if you are like me, you are sick and tired of giant dependency trees that have the distinct possibility of breaking at any time.

Vue ShortKey plugin for Vue.js

Vue-ShortKey - The ultimate shortcut plugin to improve the UX .Vue-ShortKey - plugin for VueJS 2.x accepts shortcuts globaly and in a single listener.

A Vue component to hzqing vue Timeline

hzqing-vue-timeline . Vue's timeline plugin .A Vue component to hzqing-vue-timeline A Vue time plugin