1.0.7 • Published 3 years ago
@redbud-hk/cordova-plugin-gaze v1.0.7
Cordova Plugin Gaze
Eyetracking Plugin for Cordova Projects.
Example Usage
Please run the plugin after deviceReady
.
// Prepare the Gaze View
await cordova.plugins["cordova-plugin-gaze"].prepare();
// Get the Frame Size of the Gaze View (Mobile View Size)
const { height, width } = await cordova.plugins["cordova-plugin-gaze"].frame();
console.log(height, width);
// Start Eye Tracking Test
const { data, file } = await
cordova.plugins["cordova-plugin-gaze"].start(
"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4",
"http://techslides.com/demos/sample-videos/small.mp4",
"https://www.lotus-qa.com/wp-content/uploads/2020/02/testing.jpg",
"Start", "Stop", "Loading...", 1.0
);
console.log('Coordinates:', data);
console.log('File URL:', file);
Plugin Functions
prepare
Initialize the Eye Gaze View. Please run this function before calling other function(s) on this plugin
frame
Get the Height and Width of the Full-Screen View (a.k.a Device Frame Size).
- Output :
height
: The Device Frame Height in Number (Double).width
: The Device Frame Width in Number (Double).
start
Input :
- Eye-Tracking Main Video URL
- Ready Video URL (e.g : 3-2-1 Video)
- Pause Image URL
- Start Button Text
- Stop Button Text
- Auto Pause / Resume Continuous Period in Seconds
Process :
Start the Eye Tracking Test and play the video. This Function will required the permission for Microphone, Photos, Camera. The function process as follow :
- Ask for all permission(s)
- Load the Video from the given URL
- Turn on the Front Camera for Eye Tracking
- Show the
Start Button
Once the Start Button
is clicked, the function continue as follow :
- Play the Video with Sound
- Start the Screen Recording
- Start the Audio Recording
- Start recording Gaze Coordinates
- Record the Front Camera AR Video
Once the Video is finished :
- Stop the Video Player
- Stop the Screen Recording
- Stop Front Camera AR Reocrding
- Stop recording Gaze Coordinates
- Output the Front Camera AR Recording to Photos
Output :
data
: The Gaze Coordinate Array in the format of[number, number, number, number]
which equals[X-Axis, Y-Axis, Distance in CM, Time since starting in milliseconds]
file
: The Front Camera AR Recording File Path