@codekraft-studio/vue-record

中文文档
0.0.3发布于 2020/01/27CommonJS近 30 天下载 5420

custom components for MediaRecorder API

原始使用文档
文档目录6 节
  1. Installation
  2. Usage
  3. Examples
  4. Recording Audio
  5. Recording Video
  6. License

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

版本与发布记录

@codekraft-studio/vue-record 共发布 3 个版本,首次发布于 2019/09/07;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.0.3latest2020/01/276 年前
0.0.22019/10/137 年前
0.0.12019/09/077 年前

关于 @codekraft-studio/vue-record 的常见问题

@codekraft-studio/vue-record 是什么?

custom components for MediaRecorder API

如何安装 @codekraft-studio/vue-record?

在项目目录运行 npm install @codekraft-studio/vue-record,或使用 pnpm add / yarn add / bun add。

@codekraft-studio/vue-record 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/codekraft-studio__vue-record 是否存在。

@codekraft-studio/vue-record 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@codekraft-studio/vue-record 可以商用吗?

@codekraft-studio/vue-record 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@codekraft-studio/vue-record 的下载量有多少?

根据 npm 官方下载统计,@codekraft-studio/vue-record 在 2026/10/10 – 2026/11/08 这 30 天内被下载 5,420 次,日均约 181 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@codekraft-studio/vue-record 还在维护吗?

最新版本 0.0.3 发布于 2020/01/27(6 年前);至今共发布 3 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/09/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。