Giter Club home page Giter Club logo

ntrf-doc's Introduction

#个人学习笔记及资料整理 持续更新...

  • vagrant使用及centos下的LAMP环境搭建
  • Sublime Text3 实用配置

ntrf-doc's People

Contributors

lenrinfvck avatar

Watchers

 avatar

Forkers

frandavid

ntrf-doc's Issues

Web Media Application

MediaDevices

MediaDevices 接口提供访问连接媒体输入的设备,如照相机和麦克风,以及屏幕共享等。它可以使你取得任何硬件资源的媒体数据。

事件

devicechange 系统中支持的设备变动时触发

方法

1. MediaDevices.enumerateDevices()

获取有关系统中可用的媒体输入和输出设备的一系列信息。

navigator.mediaDevices.enumerateDevices().then((...arg)=> console.log(arg))

image

2. MediaDevices.getUserMedia()

在用户通过提示允许的情况下,打开系统上的相机或屏幕共享和/或麦克风,并提供 MediaStream 包含视频轨道和/或音频轨道的输入。

navigator.mediaDevices.getUserMedia(constraints)
.then(function(stream) {
  /* 使用这个stream stream */
})
.catch(function(err) {
  /* 处理error */
});

2.1 参数 constraints

{ audio: true, video: true }
{
  audio: false,
  video: { width: 1280, height: 720 }
}
//前置摄像头(默认)
{ video: { facingMode: "user" } }
//后置摄像头
{ video: { facingMode: { exact: "environment" } } }

2.2 返回值

返回一个 Promise , 这个Promise成功后的回调函数带一个 MediaStream 对象作为其参数。

example: /media-device/qr-code.html

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.