In HTML5, there are a large number of device API-related content, complex structures, and overlapping content. You may encounter many problems during use. Next I will discuss my personal understanding about these issues.
1,The media captureapi vs system information API can both access the camera and microphone. What is the difference?
Background: The media capture API defines a high-level API to access the camera and microphone of a device. The input device of the systeminformation API displays the input device of the system, for example, the mouse, keyboard, camera, and microphone.
Answer: The media captureapi defines the API to capture the audio, images, and videos of devices. Note that it is a high-level interface that enables programmable access to cameras and microphones.
The system informationapi focuses on the device status (although it also has the set method ). For example, you can read the following attributes of the camera: supportsvideo (whether video recording is supported), hasflash (whether flash is supported), sensorpixels (image sensor pixel), and maxzoomfactor (max zoom supported ), you can also traverse all cameras.
Therefore, the former is a high-level interface to implement programmable access to cameras and microphones, while the latter focuses on the status of cameras and microphones.
Cameras and microphones are important functions of mobile phones
2,Deviceorientationevent vs system information API vs sensor API, all of which can read sensor information. What is the difference?
Background: deviceorientationevent provides event processing for physical and motion information of devices. common sources of information include gyroscope, compass, and other sensors. A specific part of the system information API is sensor results. The sensor API itself is an API defined for sensors.
Answer: Deviceorientationevent focuses on motion and orientation sensors. It does not provide access to basic sensor data or control over sensors, but is a high-level encapsulation.
System informationapi currently focuses on environmental sensors, including environmental brightness, ambient temperature, atmospheric pressure, and proximity (close to the sensor and remember if the screen is automatically closed when the face is attached to the iPhone screen ?), No other sensors are supported.
The sensor API, as its name, is ready to provide access to all known sensors and provide raw sensor data.
Therefore, the former is a high-level encapsulation of motion and orientation sensors, the second focuses on the information of environmental sensors, and the third provides the raw data of all sensors.
Sensor-supported gravity sensing games
3,Speech inputapi vs the media capture API, both of which are related to voice input. What are the similarities and differences between them?
Background: The speech input API supports voice input and recognition. The media capture API can obtain the input audio.
Answer: The speech input API was proposed by Google. Currently, it is only a draft file and mainly used for speech recognition. It aims to help Web developers use standard speech recognition software. Due to the importance of Speech Recognition in the future, we can imagine that this API will have a fierce Standard battle between Google, Apple and Microsoft and will not easily become a draft of the Working Group.
Google and Apple will have a fight
The media capture API, as a draft of the W3C-recognized working group, focuses primarily on audio collection.
Therefore, the former is mainly a draft document for speech recognition, while the latter is a draft working group focusing on audio collection.
4,The media capture vs HTML media capture. What are the links and differences between the two?
Background: The two names are similar, and they are both components of deviceapi.
Answer: Both focus on cameras and microphones. For example, the HTML media capture API can only get images and audio and video through the form after capturing. It is a simple, easy-to-implement API that can be conveniently used in most cases. The media capture API (getusermedia) is derived from the device tag and is a programmable access to cameras and microphones. In the future, it will become a specification of WebRTC (may not belong to HTML5 ), both opera mobile and chrome provide support for it. It is very powerful and fun, and can capture videos in real time, but it is more complicated and has some security problems.
Use HTML media capture for multimedia collection during File Upload
5,Device apivs device characteristics. What are the links and differences between the two?
Background: The device API includes the systeminformation API, which includes device characteristics, sensor results, and network characteristics. For details, see http://dev.w3.org/2009/dap/system-info /.
Answer: Device APIs are all related APIs of devices, including hardware and software. device characteristics focuses on the hardware features of devices. The overall structure of device API is as follows:
Device API Structure
Finally, you will notice that in most HTML5 Draft pages, "statusof this document" will have the following text "publication as a working draft does not imply endorsement by the W3C membership. this is a draft document and may be updated, replaced or obsoleted by othersponents at any time. it is inappropriate to cite this document as other thanwork in progress. ", which means that these specifications are still just drafts, not final stability, and W3C may make adjustments at any time.
Appendix: API address
The media capture API: http://www.w3.org/TR/media-capture-api/
HTML media capture API: http://www.w3.org/TR/2011/WD-html-media-capture-20110414/
System informationapi: http://www.w3.org/TR/2010/WD-system-info-api-20100202/
Orientationevent: http://www.w3.org/TR/orientation-event/
Sensor API: http://dev.w3.org/2009/dap/system-info/Sensors.html
Speech inputapi: http://www.w3.org/2005/Incubator/htmlspeech/2010/10/google-api-draft.html
Original article, reprinted with the source: column of Jiang Yujie