# aliyun-media-to-data

> - 普通用法 ``` import Media from 'aliyun-media-to-data';

Latest version **0.0.9** (published 2022-12-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install aliyun-media-to-data
pnpm add aliyun-media-to-data
yarn add aliyun-media-to-data
bun add aliyun-media-to-data
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2022-12-13 |
| First published | 2022-11-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 69.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 慈铁 |
| Maintainers | light5647 |

## Links

- npm: https://www.npmjs.com/package/aliyun-media-to-data
- npm.io page: https://npm.io/package/aliyun-media-to-data

## Dependencies (2)

- [events](https://npm.io/package/events.md) latest
- [aliyun-light-clock](https://npm.io/package/aliyun-light-clock.md) 0.1.5

## Recent versions

- 0.0.9 (latest) — 2022-12-13
- 0.0.8 — 2022-12-12
- 0.0.7 — 2022-12-12
- 0.0.6 — 2022-12-06
- 0.0.5 — 2022-11-15

## README

- 普通用法
```
import Media from 'aliyun-media-to-data';

const mediaLib = new Media({
  video: true,
  audio: true,
});

mediaLib.on('data', data => {
  const { audio, video } = data;
  // base64数据
  console.log(audio.data, video.data);
})

navigator.mediaDevices.getUserMedia({
  video: true,
  audio: true,
})
.then(function(stream: MediaStream) {
  mediaLib.setStream(stream);
});
```

- 如果要更改获取video数据的配置
```
const mediaLib = new Media({
  video: {
    // 一秒获取多少图片，默认10
    fps: 10,
    // 获取图片的宽度，等比缩放，默认200
    width: 200,
  },
  audio: {
    // 获取音频数据的频率，默认60
    fps: 60,
  },
});
```

---
_Source: https://npm.io/package/aliyun-media-to-data · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
