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

fhr

v0.0.13

Published

PC视频录制,拍照照片。支持[h5 getUserMedia](https://developer.mozilla.org/zh-CN/docs/Web/API/MediaDevices/getUserMedia)和flash。优先使用h5 getUserMedia的方式。

Downloads

7

Readme

fhr视频录制

PC视频录制,拍照照片。支持h5 getUserMedia和flash。优先使用h5 getUserMedia的方式。

安装

npm install --save fhr

使用方法

录制视频

import { Fhr } from 'fhr';
// 也可以在html中以引入js的方式,就如提供的demo一样
// <script src="../../lib/index.js"></script>

const fhrObject = new Fhr({
// 如果是html引入的方式,这儿应该是
// const fhrObject = new fhr.Fhr({
    type: 'video',
    swfUrl: '../../lib/video.swf',
    fmsUrl: "rtmp://10.250.140.126:1935/test",
    content: document.getElementById('test'),
    callback: function(str) {
        console.log(str);
    },
});

注:

type: 录制视频传入video。默认值为video。

swfUrl: 将mode_modules/fhr/lib/video.swf拷贝出来后放在server上的目录。

fmsServer: rtmp服务地址。

content: 作为渲染的载体。

callback: 执行的回调,含义最后来提示。

开始录制事件

fhrObject.start();

结束录制事件

fhrObject.stop();

获取结果事件

fhrObject.getResult();

注: 如果支持h5方式,录制的视频在结果中以base64的格式返回,文件后缀为.webm,如果以flash的方式录制的视频,在结果中能拿到保存在fmsServer中的文件名,文件格式为.flv。

拍摄照片

import { Fhr } from 'fhr';
// 也可以在html中以引入js的方式,就如提供的demo一样
// <script src="../../lib/index.js"></script>

const fhrObject = new Fhr({
// 如果是html引入的方式,这儿应该是
// const fhrObject = new fhr.Fhr({
    type: 'photo',
    swfUrl: '../../lib/video.swf',
    content: document.getElementById('test'),
    callback: function(str) {
        console.log(str);
    },
});

注:

type: 拍摄照片传入photo。

swfUrl: 将mode_modules/fhr/lib/video.swf拷贝出来后放在server上的目录。

content: 作为渲染的载体。

callback: 执行的回调,含义最后来提示。

拍照事件

fhrObject.take();

获取结果事件

fhrObject.getResult();

注:

无论是h5的方式还是flash方式,返回的照片结果都是base64。

callback含义

callback接受一个参数,如果参数不为空,即出现了错误。

初始化完成后会执行一个callback(''),这个时候就可以用来控制按钮能否点击。

兼容性

拥有的ie,chrome,firefox,safari已测试通过。