npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ac-recorder

v1.0.2

Published

Based on MediaRecorder and AudioContext implementation, it can record audio and canvas on the web page and generate a video file to download locally.

Downloads

6

Readme

ac-recorder

基于 MediaRecorder 和 AudioContext 实现,能够录制网页上的 audio 和 canvas,生成一个视频文件下载到本地。 Based on MediaRecorder and AudioContext implementation, it can record audio and canvas on the web page and generate a video file to download locally.

🔗 支持 Chrome 🔗 支持 Safari(实测效果更好)

实例化

实例化参数: constructor(targetAudio, targetCanvas)

  • targetAudio: 可播放音频的 audio 元素或是一个 '#id_name' or '.class_name' css 选择器
  • targetCanvas: 播放动画或视频的 canvas 元素或是一个 '#id_name' or '.class_name' css 选择器

配置参数(可选)

.setOptions()

创建录制器

.createRecorder()

录制器控制方法(主要方法)

.start()
.pause()
.resume()
.stop()

其它方法

.preview()
.closePreview()
.download()
.changeAudio()

Usage

  1. 导入 ACRecorder 类:
import { ACRecorder } from "./index.js";
  1. 实例化 ACRecorder,传入要录制的 audio 元素和 canvas 元素:
let ACR = new ACRecorder(document.querySelector("#audio"), "#canvas");
  1. 设置监听事件(可选):
ACR.setListeners({
  start: () => {...},
  fail: () => {...},
  pause: () => {...},
  resume: () => {...},
  stop: () => {...}
});
  1. 开始录制:
ACR.start();
  1. 暂停录制:
ACR.pause();
  1. 恢复录制:
ACR.resume();
  1. 停止录制:
ACR.stop();
  1. 预览录制视频(可选):
ACR.preview();
  1. 关闭视频预览(可选):
ACR.closePreview();
  1. 下载录制视频(可选):
ACR.download();
  1. 销毁录制器(可选):
ACR.destroy();

Tips

new AudioContext()必须在某个用户操作之后执行,否则会出现“The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page”警告,导致音频无法播放。