Chapter 11 The touch interface and accessing hardware Flashcards

1
Q

where can you find the information provided by gyroscopes, compasses, and accelerometers?

A

HTML5 DeviceOrientation Event API Specification created by the W3C.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How many and what events are contained in the DevicePOrientation Event API?

A

devicemotion
device orientation
compassneedscalibration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is devicemotion?

A

This event is automatically and continually fired passing information received from the motion sensing hardware.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is deviceorientation?

A

This event is automatically fired when a major change in the device orientation occurs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is compassneedscalibration?

A

This event is automatically fired if it is determined that there is a difference in the motion sensing data that is being gathered from the motion sensing hardware.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What coordinates are used to provide information from motion sensing hardware?

A

x, y and z coordinates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the alpha value?

A

Rotation of the z axis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the beta value?

A

Rotation of the x axis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the gamma value?

A

Rotation of the y axis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Is deviceorientation part of window object?

A

Yes, it is part of window object and the event listener must be added to the window object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the js for deviceorientation?

A
AddEventListener and Collect Data
window.addEventListener('deviceorientation', function(event) {
var alpha = event.alpha;
var beta = event.beta;
var gamma = event.gamma;
// Do something
}, false);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the two property that devicemotion provides?

A

Acceleration property
rorationRate property
accelerationIncludingGravity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is rotationRate property?

A

The rotationRate property provides the rotation rate in degrees per second around each axis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What attribute to use when capturing still video, picture and audio by using a web cam?

A

Example 1: Take a Still Picture using web cam

Example 2: Capture Video using web cam

Example 3: Capture Audio using microphone device

***accept=”audio/”capture

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is getUserMedia() used for?

A

The getUserMedia() function is part of this specification that is used to get the video or still image that can then be streamed to a video control

There is no src attribute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the javascript for getUserMedia()?

A

Streaming Video using getUserMedia()

navigator.getUserMedia({video: true, audio: true}, function(localMediaStream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(localMediaStream);
17
Q

What is geolocation APi?

A

The geolocation API is used to get the physical location of the device based on the GPS coordinates of a phone, or the IP address of a PC, laptop, or tablet.

18
Q

What property does geolocation use?

A

The Geolocation object contains the getCurrentPosition() method that is used to retrieve the latitude and longitude coordinates of the device.

19
Q

What is web worker?

A

The Web Workers API is used to run JavaScript code in the background that does not require the web page to wait before allowing the user to continue using and interacting with the web page. Web workers are great for lengthy calculations and complex code that takes a long time to execute.

20
Q

How to create a web worker?

A

the JavaScript code that you want to execute must be saved in an external text file with a .js file extension.

It must include worker() method and providing external JS file as the parameter

Create a Web Worker Object
var myWebWorker = new Worker("webWorkerCode.js");
21
Q

What is postmessage() used for?

A

The postMessage() method should be used inside of the external JavaScript file to update the web page with the status of the web worker code that is running in the background. This message can be used to inform the user that the web worker has completed

22
Q

How to terminate the webworker?

A

myWebWorker.terminate();

23
Q

What is file API?

A

The File API in HTML5 provides a standard way to work with local files on the user’s device. Files can be selected and read using the File API for a number of different purposes.

24
Q

What are the buttons for file api in chrome and IE?

A

In chrome = Button = Choose file

IE = button = browse..

25
Q

What is filelist?

A

The FileList is an arrary of file objects that have been selected.

26
Q

What is filereader object used for?

A

Reads the contents of a file?

27
Q

What are the events in gestures?

A

Touchstart, touchmove, touchend

28
Q

What are some of the libraries that supports gestures?

A

hammer.js Gesture Library.

29
Q

is there a gesture specification created by W3C?

A

Nope, there is only specifications from microsoft, apple and android gesture.

30
Q

What is touchstart event?

A

When the user first touches a DOM element on the touch screen

31
Q

What is touchend?

A

When the user stops touching the DOM element on the touch screen

32
Q

What is touchmove?

A

When the touch point moves across the surface

33
Q

What is touchcancel?

A

When the application cancels the touch or the finger moves outside of a touch area or off the display.