Skip to content

Instantly share code, notes, and snippets.

@kevalpatel2106
Created October 31, 2016 17:58
Show Gist options
  • Save kevalpatel2106/e96c22d61812f161fb8c5b204e62f4f9 to your computer and use it in GitHub Desktop.
Save kevalpatel2106/e96c22d61812f161fb8c5b204e62f4f9 to your computer and use it in GitHub Desktop.
mVideoView = (UserAwareVideoView) findViewById(R.id.video_view);
mVideoView.setUserAwarenessListener(new UserAwarenessListener() {
@Override
public void onErrorOccurred(int errorCode) {
//Handle errors.
switch (errorCode) {
case Errors.UNDEFINED:
//Unknown error occured.
//This will stop eye tracking, but video will keep playing.
break;
case Errors.FRONT_CAMERA_NOT_AVAILABLE:
//This indicates that device doesnot have the front camera
//This will stop eye tracking, but video will keep playing.
break;
case Errors.CAMERA_PERMISSION_NOT_AVAILABLE:
//This indicates that camera permission is not available.
//Ask for the runtime camera permission.
break;
case Errors.LOW_LIGHT:
//This indicates that there is dark out side. We cannot detect user's face.
//This will stop eye tracking, but video will keep playing.
break;
}
}
@Override
public void onEyeTrackingStarted() {
//Eye detection started
}
@Override
public void onEyeTrackingStop() {
//Eye detection is stopped.
}
});
//Atatch your media controller, provide video to play and start the video
//......
//......
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment