camera api (含图片预览)

参考地址

  • 主要为利用input type=file, accept="image/*" 进行处理
  • 图片预览方式(两种)
const file = e.target.files[0]
// 方式1
const url1 = window.URL.createObjectURL(file);
let url2 // 方式2
const reader = new FileReader();
reader.onload = (e) => {
url2 = e.target.result;
};
reader.readAsDataURL(file);

touch events (触屏事件)

参考地址

  • touchstart
  • touchend
  • touchcancel 电话的接入或者弹出信息等比较高级的事件触发,一般做保存操作
  • touchmove

geolocation

参考地址

  • 注意谷歌浏览器要https才能提供定位服务
    if (navigator.geolocation){
navigator.geolocation.getCurrentPosition((position) => {
this.geolocation = `latitude:${position.coords.latitude},longitude:${position.coords.longitude}`
}, (err) => {
console.log(err);
}, {
enableHighAccuracy: true,
maximumAge : 30000, // buffer memory timre
timeout : 27000 // waiting time
})
} else {
alert('geolocation not supported!')
}

device orientation and motion

参考地址

    window.addEventListener('deviceorientation',(doe) => {
this.absolute = doe.absolute //false 表示方向数据由设备本身坐标系提供
this.alpha = doe.alpha // 绕Z轴0-360 进入时手机水平正对的方向为0或360
this.beta = doe.beta // 绕X轴-180~180 描述由前向后旋转
this.gamma = doe.gamma // 绕Y轴-90~90 描述由左向右旋转
}, true) // chrome v65 只支持accelerationIncludingGravity和interval(应该因为一些限制没有找到),其它浏览器最新版基本都支持
window.addEventListener('devicemotion', (dme) => {
this.acceleration = dme.acceleration
this.accelerationIncludingGravity = dme.accelerationIncludingGravity
this.rotationRate = dme.rotationRate
this.interval = dme.interval
}, false)

Pointer Lock(鼠标锁定)

参考地址

    <button onclick="lockPointer();">锁住它!</button>
<div id="pointer-lock-element" style="width:500px;height:500px;background-color: red"></div>

// 简单示例,将鼠标锁定在 pointer-lock-element 元素内
let = document.getElementById("pointer-lock-element"); document.addEventListener("mousemove", function(e) {
var movementX = e.movementX
movementY = e.movementY // 打印鼠标移动的增量值。
console.log("X=" + movementX, "Y=" + movementY);
}, false); function lockPointer() {
elem = document.getElementById("pointer-lock-element");
elem.requestPointerLock = elem.requestPointerLock ||
elem.mozRequestPointerLock ||
elem.webkitRequestPointerLock;
elem.requestPointerLock();
}

HTML5 Device Access (设备访问)的更多相关文章

  1. [转] HTML5+规范:device(管理设备信息)

    http://blog.csdn.net/qq_27626333/article/details/51815310 Device模块管理设备信息,用于获取手机设备的相关信息,如IMEI.IMSI.型号 ...

  2. 与众不同 windows phone (18) - Device(设备)之加速度传感器, 数字罗盘传感器

    原文:与众不同 windows phone (18) - Device(设备)之加速度传感器, 数字罗盘传感器 [索引页][源码下载] 与众不同 windows phone (18) - Device ...

  3. 与众不同 windows phone (20) - Device(设备)之位置服务(GPS 定位), FM 收音机, 麦克风, 震动器

    原文:与众不同 windows phone (20) - Device(设备)之位置服务(GPS 定位), FM 收音机, 麦克风, 震动器 [索引页][源码下载] 与众不同 windows phon ...

  4. 与众不同 windows phone (19) - Device(设备)之陀螺仪传感器, Motion API

    原文:与众不同 windows phone (19) - Device(设备)之陀螺仪传感器, Motion API [索引页][源码下载] 与众不同 windows phone (19) - Dev ...

  5. Blazor组件自做十一 : File System Access 文件系统访问 组件

    Blazor File System Access 文件系统访问 组件 Web 应用程序与用户本地设备上的文件进行交互 File System Access API(以前称为 Native File ...

  6. 用DBMS_ADVISOR.SQLACCESS_ADVISOR创建SQL Access Advisor访问优化建议

    使用OEM方式来创建SQL Access Advisor访问优化建议,已经是四五年的事了,下面就来写写怎样使用DBMS_ADVISOR.SQLACCESS_ADVISOR来创建SQL Access A ...

  7. 与众不同 windows phone (23) - Device(设备)之硬件状态, 系统状态, 网络状态

    原文:与众不同 windows phone (23) - Device(设备)之硬件状态, 系统状态, 网络状态 [索引页][源码下载] 与众不同 windows phone (23) - Devic ...

  8. 与众不同 windows phone (22) - Device(设备)之摄像头(硬件快门, 自动对焦, 实时修改捕获视频)

    原文:与众不同 windows phone (22) - Device(设备)之摄像头(硬件快门, 自动对焦, 实时修改捕获视频) [索引页][源码下载] 与众不同 windows phone (22 ...

  9. 与众不同 windows phone (21) - Device(设备)之摄像头(拍摄照片, 录制视频)

    原文:与众不同 windows phone (21) - Device(设备)之摄像头(拍摄照片, 录制视频) [索引页][源码下载] 与众不同 windows phone (21) - Device ...

随机推荐

  1. kuangbin专题 专题一 简单搜索 棋盘问题 POJ - 1321

    题目链接:https://vjudge.net/problem/POJ-1321 题意:给一张棋盘,‘#’表示可以下棋的地方,‘.’表示不能下棋的地方.棋盘是n*n的,要求能放下k个棋子,要求k个棋子 ...

  2. c#零碎知识随笔

    1. 字符串转换日期: DateTime.ParseExact(item.Attribute("event-timestamp").Value,"dd.MM.yyyy H ...

  3. 1. 在Mac OS中配置CMake的详细图文教程

    CMake是一个比make更高级的跨平台的安装.编译.配置工具,可以用简单的语句来描述所有平台的安装(编译过程).并根据不同平台.不同的编译器,生成相应的Makefile或者project文件.本文主 ...

  4. Connecting to the Network

    This lesson shows you how to implement a simple application that connects to the network. It explain ...

  5. linux应用程序设计--Makefile工程管理

    Makefile文件描述了整个工程的编译.链接等规则.包括:工程中哪些源文件需要编译以及如何编译:需要创建哪些库文件以及如何创建这些库文件.如何产生最终的可执行文件. Makefile相关术语 1.规 ...

  6. Ubuntu 18.04 root 使用ssh密钥远程登陆

    前言: Ubuntu默认是禁止root用户远程登陆 本教程解决Ubuntu 18.04版本 root用户 使用ssh密钥无法远程登陆的问题 问题发生的环境: 腾讯云,重装Ubuntu服务器时选择使用s ...

  7. 【原创】一个shell脚本记录(实现rsync生产文件批量迁移功能)

    #!/bin/bash #Date:2018-01-08 #Author:xxxxxx #Function:xxxxxx #Change:2018-01-17 # #设置忽略CTRL+C信号 trap ...

  8. 五分钟了解Zabbix

    Zabbix-简介 Zabbix概念 Zabbix组成 Server Zabbix server 是 Zabbix agent 向其报告可用性.系统完整性信息和统计信息的核心组件.是存储所有配置信息. ...

  9. 如何利用Azure Automation以及Tag自动开关VM

    这是本博客第一篇技术相关的小贴士,在这里我不会详细介绍所涉及的技术组件的具体使用细节,因为我相信这些大家都可以通过官方文档了解到.如果你是一个看了官方文档依然一脸茫然的IT小白,个人建议是先从基础重新 ...

  10. 推荐:经典SQL语句大全

    一.基础 .说明:备份sql server--- 创建 备份数据的 device USE master EXEC sp_addumpdevice 'disk', 'testBack', 'c:/mss ...